From c6ff1eba4c33daa62a6a2186ead4e2c0a1abd9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 19 Apr 2018 00:05:04 +0200 Subject: [PATCH] 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 --- src/sao.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sao.js b/src/sao.js index 9ff1f811c3..f8d14a2d7d 100644 --- a/src/sao.js +++ b/src/sao.js @@ -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; };