f288e3a56b9c239252ce5b81e7e47a6df348356ef6651068c29917ea5e71bb32197713098a267e445859580f0c64ab68317ffcf6df7346126f64c2526ac94e 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. import { Moment } from './constructor';
  2. var proto = Moment.prototype;
  3. import { add, subtract } from './add-subtract';
  4. import { calendar, getCalendarFormat } from './calendar';
  5. import { clone } from './clone';
  6. import { isBefore, isBetween, isSame, isAfter, isSameOrAfter, isSameOrBefore } from './compare';
  7. import { diff } from './diff';
  8. import { format, toString, toISOString } from './format';
  9. import { from, fromNow } from './from';
  10. import { to, toNow } from './to';
  11. import { stringGet, stringSet } from './get-set';
  12. import { locale, localeData, lang } from './locale';
  13. import { prototypeMin, prototypeMax } from './min-max';
  14. import { startOf, endOf } from './start-end-of';
  15. import { valueOf, toDate, toArray, toObject, toJSON, unix } from './to-type';
  16. import { isValid, parsingFlags, invalidAt } from './valid';
  17. import { creationData } from './creation-data';
  18. proto.add = add;
  19. proto.calendar = calendar;
  20. proto.clone = clone;
  21. proto.diff = diff;
  22. proto.endOf = endOf;
  23. proto.format = format;
  24. proto.from = from;
  25. proto.fromNow = fromNow;
  26. proto.to = to;
  27. proto.toNow = toNow;
  28. proto.get = stringGet;
  29. proto.invalidAt = invalidAt;
  30. proto.isAfter = isAfter;
  31. proto.isBefore = isBefore;
  32. proto.isBetween = isBetween;
  33. proto.isSame = isSame;
  34. proto.isSameOrAfter = isSameOrAfter;
  35. proto.isSameOrBefore = isSameOrBefore;
  36. proto.isValid = isValid;
  37. proto.lang = lang;
  38. proto.locale = locale;
  39. proto.localeData = localeData;
  40. proto.max = prototypeMax;
  41. proto.min = prototypeMin;
  42. proto.parsingFlags = parsingFlags;
  43. proto.set = stringSet;
  44. proto.startOf = startOf;
  45. proto.subtract = subtract;
  46. proto.toArray = toArray;
  47. proto.toObject = toObject;
  48. proto.toDate = toDate;
  49. proto.toISOString = toISOString;
  50. proto.toJSON = toJSON;
  51. proto.toString = toString;
  52. proto.unix = unix;
  53. proto.valueOf = valueOf;
  54. proto.creationData = creationData;
  55. // Year
  56. import { getSetYear, getIsLeapYear } from '../units/year';
  57. proto.year = getSetYear;
  58. proto.isLeapYear = getIsLeapYear;
  59. // Week Year
  60. import { getSetWeekYear, getSetISOWeekYear, getWeeksInYear, getISOWeeksInYear } from '../units/week-year';
  61. proto.weekYear = getSetWeekYear;
  62. proto.isoWeekYear = getSetISOWeekYear;
  63. // Quarter
  64. import { getSetQuarter } from '../units/quarter';
  65. proto.quarter = proto.quarters = getSetQuarter;
  66. // Month
  67. import { getSetMonth, getDaysInMonth } from '../units/month';
  68. proto.month = getSetMonth;
  69. proto.daysInMonth = getDaysInMonth;
  70. // Week
  71. import { getSetWeek, getSetISOWeek } from '../units/week';
  72. proto.week = proto.weeks = getSetWeek;
  73. proto.isoWeek = proto.isoWeeks = getSetISOWeek;
  74. proto.weeksInYear = getWeeksInYear;
  75. proto.isoWeeksInYear = getISOWeeksInYear;
  76. // Day
  77. import { getSetDayOfMonth } from '../units/day-of-month';
  78. import { getSetDayOfWeek, getSetISODayOfWeek, getSetLocaleDayOfWeek } from '../units/day-of-week';
  79. import { getSetDayOfYear } from '../units/day-of-year';
  80. proto.date = getSetDayOfMonth;
  81. proto.day = proto.days = getSetDayOfWeek;
  82. proto.weekday = getSetLocaleDayOfWeek;
  83. proto.isoWeekday = getSetISODayOfWeek;
  84. proto.dayOfYear = getSetDayOfYear;
  85. // Hour
  86. import { getSetHour } from '../units/hour';
  87. proto.hour = proto.hours = getSetHour;
  88. // Minute
  89. import { getSetMinute } from '../units/minute';
  90. proto.minute = proto.minutes = getSetMinute;
  91. // Second
  92. import { getSetSecond } from '../units/second';
  93. proto.second = proto.seconds = getSetSecond;
  94. // Millisecond
  95. import { getSetMillisecond } from '../units/millisecond';
  96. proto.millisecond = proto.milliseconds = getSetMillisecond;
  97. // Offset
  98. import {
  99. getSetOffset,
  100. setOffsetToUTC,
  101. setOffsetToLocal,
  102. setOffsetToParsedOffset,
  103. hasAlignedHourOffset,
  104. isDaylightSavingTime,
  105. isDaylightSavingTimeShifted,
  106. getSetZone,
  107. isLocal,
  108. isUtcOffset,
  109. isUtc
  110. } from '../units/offset';
  111. proto.utcOffset = getSetOffset;
  112. proto.utc = setOffsetToUTC;
  113. proto.local = setOffsetToLocal;
  114. proto.parseZone = setOffsetToParsedOffset;
  115. proto.hasAlignedHourOffset = hasAlignedHourOffset;
  116. proto.isDST = isDaylightSavingTime;
  117. proto.isLocal = isLocal;
  118. proto.isUtcOffset = isUtcOffset;
  119. proto.isUtc = isUtc;
  120. proto.isUTC = isUtc;
  121. // Timezone
  122. import { getZoneAbbr, getZoneName } from '../units/timezone';
  123. proto.zoneAbbr = getZoneAbbr;
  124. proto.zoneName = getZoneName;
  125. // Deprecations
  126. import { deprecate } from '../utils/deprecate';
  127. proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth);
  128. proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth);
  129. proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear);
  130. proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone);
  131. proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted);
  132. export default proto;