From 174dfb57a1da2f6c0ee82d9839af2b99ef33ad5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 27 Mar 2015 15:40:14 +0100 Subject: [PATCH] Add min/max of Date/Time --- src/sao.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sao.js b/src/sao.js index 1787a61986..dda4371404 100644 --- a/src/sao.js +++ b/src/sao.js @@ -88,6 +88,13 @@ var Sao = {}; return date; }; + Sao.Date.min = moment(new Date(-100000000 * 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)); + Sao.Date.max.set({hour: 0, minute: 0, second: 0, millisecond: 0}); + Sao.Date.max.isDate = true; + Sao.DateTime = function(year, month, day, hour, minute, second, millisecond, utc) { var datetime = moment(); @@ -113,6 +120,11 @@ var Sao = {}; return datetime; }; + Sao.DateTime.min = moment(new Date(-100000000 * 86400000)).local(); + Sao.DateTime.min.isDateTime = true; + Sao.DateTime.max = moment(new Date(100000000 * 86400000)).local(); + Sao.DateTime.max.isDateTime = true; + Sao.Time = function(hour, minute, second, millisecond) { var time = moment({hour: hour, minute: minute, second: second, millisecond: millisecond || 0});