MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / createDate

Function createDate

tests/test_code/js/moment/moment.js:1275–1291  ·  view source on GitHub ↗
(y, m, d, h, M, s, ms)

Source from the content-addressed store, hash-verified

1273 }
1274
1275 function createDate(y, m, d, h, M, s, ms) {
1276 // can't just apply() to create a date:
1277 // https://stackoverflow.com/q/181348
1278 var date;
1279 // the date constructor remaps years 0-99 to 1900-1999
1280 if (y < 100 && y >= 0) {
1281 // preserve leap years using a full 400 year cycle, then reset
1282 date = new Date(y + 400, m, d, h, M, s, ms);
1283 if (isFinite(date.getFullYear())) {
1284 date.setFullYear(y);
1285 }
1286 } else {
1287 date = new Date(y, m, d, h, M, s, ms);
1288 }
1289
1290 return date;
1291 }
1292
1293 function createUTCDate(y) {
1294 var date, args;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected