From fb22f4a2322e4e0b8839ad2ea670a8028cdf03c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 7 Sep 2019 23:17:44 +0200 Subject: [PATCH] Add one day to minimal date to allow reset time Setting time to zero make the date goes backward and outside the supported range by JavaScript. issue8614 review277781002 --- src/sao.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sao.js b/src/sao.js index 04381f98ba..2db5d5004c 100644 --- a/src/sao.js +++ b/src/sao.js @@ -154,7 +154,8 @@ var Sao = {}; return date; }; - Sao.Date.min = moment(new Date(-100000000 * 86400000)); + // Add 1 day to the limit because setting time make it out of the range + Sao.Date.min = moment(new Date((-100000000 + 1) * 86400000)); Sao.Date.min.set({hour: 0, minute: 0, second: 0, millisecond: 0}); Sao.Date.min.isDate = true; Sao.Date.max = moment(new Date(100000000 * 86400000));