Skip to content

Commit

Permalink
date format fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alseambusher committed Jan 2, 2017
1 parent 9c127ac commit 58d6816
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"open": "latest",
"dialog-polyfill": "latest",
"material-design-lite": "latest",
"pm2": "latest"
"pm2": "latest",
"dateformat": "latest"
},
"engines": {
"node": "latest"
Expand Down
7 changes: 4 additions & 3 deletions src/dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { get_current_content } from "./instance";
import * as tartarus from "./lib/tartarus";
var dialogPolyfill = require("dialog-polyfill");
var dateFormat = require('dateformat');

export default function() {
var init = function() {
Expand All @@ -14,7 +15,7 @@ export default function() {
document.getElementById("dialog_add_" + get_current_content()).showModal();
let now = new Date();
document.querySelectorAll("#dialog_add_" + get_current_content() + " input[type='date']").forEach((element) => {
element.value = now.getFullYear() + "-" + (parseInt(now.getMonth()) + 1) + "-" + now.getDate();
element.value = dateFormat(now, "yyyy-mm-dd");
});
let timeDOM = document.querySelectorAll("#dialog_add_" + get_current_content() + " input[type='time']");
timeDOM[0].value = now.toTimeString().split(" ")[0];
Expand Down Expand Up @@ -67,9 +68,9 @@ export default function() {
let ids = [];
tbody.querySelectorAll(".mdl-data-table__select input").forEach((checkbox) => {
if (checkbox.checked)
tartarus[get_current_content().toLowerCase()].delete(checkbox.id.split("-")[1], tartarus[get_current_content().toLowerCase()].ui_update);
tartarus[get_current_content().toLowerCase()].delete(checkbox.id.split("-")[1], () => {});
});
tartarus[get_current_content().toLowerCase()].ui_update();
setTimeout(() => { tartarus[get_current_content().toLowerCase()].ui_update(); }, 500);
document.getElementById("dialog_delete").close();
};

Expand Down

0 comments on commit 58d6816

Please sign in to comment.