From fccf1d09138f750018719f596a70ec603912c7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 10 Feb 2016 18:21:18 +0100 Subject: [PATCH] js: don't change invalid date into browser epoch (like 31/12/1899) (#9933) --- wcs/qommon/static/js/bootstrap-datetimepicker.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wcs/qommon/static/js/bootstrap-datetimepicker.js b/wcs/qommon/static/js/bootstrap-datetimepicker.js index a84db5e..d528581 100644 --- a/wcs/qommon/static/js/bootstrap-datetimepicker.js +++ b/wcs/qommon/static/js/bootstrap-datetimepicker.js @@ -301,6 +301,9 @@ }, setValue: function() { + if (this.date == null) { + return; + } var formatted = this.getFormattedDate(); if (!this.isInput) { if (this.component){ @@ -1203,6 +1206,9 @@ d: function(d,v){ return d.setUTCDate(v); } }, val, filtered, part; + if (date.toString() === new Date(0, 0, 0, 0, 0, 0).toString()) { + return null; + } setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; setters_map['dd'] = setters_map['d']; date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()); -- 2.7.0