1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 01:57:19 +00:00

Fix missing seconds in serialised date fields

This commit is contained in:
Jermolene 2013-11-19 12:14:37 +00:00
parent 905d3e6e1e
commit b63f7a7416

View File

@ -225,17 +225,18 @@ $tw.utils.pad = function(value,length) {
return s; return s;
}; };
// Convert a date into UTC YYYYMMDDHHMM format // Convert a date into UTC YYYYMMDDHHMMSSmmm format
$tw.utils.stringifyDate = function(value) { $tw.utils.stringifyDate = function(value) {
return value.getUTCFullYear() + return value.getUTCFullYear() +
$tw.utils.pad(value.getUTCMonth() + 1) + $tw.utils.pad(value.getUTCMonth() + 1) +
$tw.utils.pad(value.getUTCDate()) + $tw.utils.pad(value.getUTCDate()) +
$tw.utils.pad(value.getUTCHours()) + $tw.utils.pad(value.getUTCHours()) +
$tw.utils.pad(value.getUTCMinutes()) + $tw.utils.pad(value.getUTCMinutes()) +
$tw.utils.pad(value.getUTCSeconds()) +
$tw.utils.pad(value.getUTCMilliseconds(),3); $tw.utils.pad(value.getUTCMilliseconds(),3);
}; };
// Parse a date from a UTC YYYYMMDDHHMMSSMMM format string // Parse a date from a UTC YYYYMMDDHHMMSSmmm format string
$tw.utils.parseDate = function(value) { $tw.utils.parseDate = function(value) {
if(typeof value === "string") { if(typeof value === "string") {
return new Date(Date.UTC(parseInt(value.substr(0,4),10), return new Date(Date.UTC(parseInt(value.substr(0,4),10),