9b2fac6bb6ee254aedbbe7c48f150c1590881e31df11b021ce91b5cce9b5b1139de3d8a7a69902c627148239e8c0679e7890dfba028e829c430420fca9c24f 713 B

123456789101112131415161718192021
  1. export function createDate (y, m, d, h, M, s, ms) {
  2. //can't just apply() to create a date:
  3. //http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
  4. var date = new Date(y, m, d, h, M, s, ms);
  5. //the date constructor remaps years 0-99 to 1900-1999
  6. if (y < 100 && y >= 0 && isFinite(date.getFullYear())) {
  7. date.setFullYear(y);
  8. }
  9. return date;
  10. }
  11. export function createUTCDate (y) {
  12. var date = new Date(Date.UTC.apply(null, arguments));
  13. //the Date.UTC function remaps years 0-99 to 1900-1999
  14. if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
  15. date.setUTCFullYear(y);
  16. }
  17. return date;
  18. }