Use ISO-8601 format for toString call on Date and DateTime

Papaparse call toString to write values. So to ensure the same format between
clients, toString on Date and DateTime must return ISO-8601 format with space
as time separator.

issue7305
review36161002
This commit is contained in:
Cédric Krier committed 2018-04-19 00:05:04 +02:00
1 parent 5817059b5d
commit c6ff1eba4c
1 file changed
+10
+10
View File
@@ -121,6 +121,9 @@ var Sao = {};
date.date(day);
date.set({hour: 0, minute: 0, second: 0, millisecond: 0});
date.isDate = true;
date.toString = function() {
return this.format('YYYY-MM-DD');
};
return date;
};
@@ -166,6 +169,13 @@ var Sao = {};
datetime.milliseconds(millisecond);
}
datetime.isDateTime = true;
datetime.toString = function() {
if (this.milliseconds()) {
return this.format('YYYY-MM-DD HH:mm:ss.SSSSSS');
} else {
return this.format('YYYY-MM-DD HH:mm:ss');
}
};
datetime.local();
return datetime;
};