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
1 changed files with 3 additions and 2 deletions

View File

@ -225,17 +225,18 @@ $tw.utils.pad = function(value,length) {
return s;
};
// Convert a date into UTC YYYYMMDDHHMM format
// Convert a date into UTC YYYYMMDDHHMMSSmmm format
$tw.utils.stringifyDate = function(value) {
return value.getUTCFullYear() +
$tw.utils.pad(value.getUTCMonth() + 1) +
$tw.utils.pad(value.getUTCDate()) +
$tw.utils.pad(value.getUTCHours()) +
$tw.utils.pad(value.getUTCMinutes()) +
$tw.utils.pad(value.getUTCSeconds()) +
$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) {
if(typeof value === "string") {
return new Date(Date.UTC(parseInt(value.substr(0,4),10),