summaryrefslogtreecommitdiffstats
path: root/js/vendor/momentjs/src/lib/create/date-from-array.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/momentjs/src/lib/create/date-from-array.js')
-rw-r--r--js/vendor/momentjs/src/lib/create/date-from-array.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/vendor/momentjs/src/lib/create/date-from-array.js b/js/vendor/momentjs/src/lib/create/date-from-array.js
new file mode 100644
index 000000000..180f55c71
--- /dev/null
+++ b/js/vendor/momentjs/src/lib/create/date-from-array.js
@@ -0,0 +1,21 @@
+export function createDate (y, m, d, h, M, s, ms) {
+ //can't just apply() to create a date:
+ //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
+ var date = new Date(y, m, d, h, M, s, ms);
+
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
+ date.setFullYear(y);
+ }
+ return date;
+}
+
+export function createUTCDate (y) {
+ var date = new Date(Date.UTC.apply(null, arguments));
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
+ date.setUTCFullYear(y);
+ }
+ return date;
+}