Get off off rails-assets
Just moving the things we currently use (and should drop in the ASAP) to vendor/assets
This commit is contained in:
parent
9fd0807a9a
commit
b6560dbb34
659 changed files with 129299 additions and 67 deletions
35
vendor/assets/javascripts/momentjs/src/lib/create/date-from-array.js
vendored
Normal file
35
vendor/assets/javascripts/momentjs/src/lib/create/date-from-array.js
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
export function createDate(y, m, d, h, M, s, ms) {
|
||||
// can't just apply() to create a date:
|
||||
// https://stackoverflow.com/q/181348
|
||||
var date;
|
||||
// the date constructor remaps years 0-99 to 1900-1999
|
||||
if (y < 100 && y >= 0) {
|
||||
// preserve leap years using a full 400 year cycle, then reset
|
||||
date = new Date(y + 400, m, d, h, M, s, ms);
|
||||
if (isFinite(date.getFullYear())) {
|
||||
date.setFullYear(y);
|
||||
}
|
||||
} else {
|
||||
date = new Date(y, m, d, h, M, s, ms);
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
|
||||
export function createUTCDate(y) {
|
||||
var date, args;
|
||||
// the Date.UTC function remaps years 0-99 to 1900-1999
|
||||
if (y < 100 && y >= 0) {
|
||||
args = Array.prototype.slice.call(arguments);
|
||||
// preserve leap years using a full 400 year cycle, then reset
|
||||
args[0] = y + 400;
|
||||
date = new Date(Date.UTC.apply(null, args));
|
||||
if (isFinite(date.getUTCFullYear())) {
|
||||
date.setUTCFullYear(y);
|
||||
}
|
||||
} else {
|
||||
date = new Date(Date.UTC.apply(null, arguments));
|
||||
}
|
||||
|
||||
return date;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue