aboutsummaryrefslogtreecommitdiffstats
path: root/library/moment/src/lib/units/year.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/moment/src/lib/units/year.js')
-rw-r--r--library/moment/src/lib/units/year.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/library/moment/src/lib/units/year.js b/library/moment/src/lib/units/year.js
deleted file mode 100644
index cc32b55b6..000000000
--- a/library/moment/src/lib/units/year.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import { makeGetSet } from '../moment/get-set';
-import { addFormatToken } from '../format/format';
-import { addUnitAlias } from './aliases';
-import { addRegexToken, match1to2, match1to4, match1to6, match2, match4, match6, matchSigned } from '../parse/regex';
-import { addParseToken } from '../parse/token';
-import { hooks } from '../utils/hooks';
-import { YEAR } from './constants';
-import toInt from '../utils/to-int';
-
-// FORMATTING
-
-addFormatToken(0, ['YY', 2], 0, function () {
- return this.year() % 100;
-});
-
-addFormatToken(0, ['YYYY', 4], 0, 'year');
-addFormatToken(0, ['YYYYY', 5], 0, 'year');
-addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
-
-// ALIASES
-
-addUnitAlias('year', 'y');
-
-// PARSING
-
-addRegexToken('Y', matchSigned);
-addRegexToken('YY', match1to2, match2);
-addRegexToken('YYYY', match1to4, match4);
-addRegexToken('YYYYY', match1to6, match6);
-addRegexToken('YYYYYY', match1to6, match6);
-
-addParseToken(['YYYYY', 'YYYYYY'], YEAR);
-addParseToken('YYYY', function (input, array) {
- array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
-});
-addParseToken('YY', function (input, array) {
- array[YEAR] = hooks.parseTwoDigitYear(input);
-});
-
-// HELPERS
-
-export function daysInYear(year) {
- return isLeapYear(year) ? 366 : 365;
-}
-
-function isLeapYear(year) {
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
-}
-
-// HOOKS
-
-hooks.parseTwoDigitYear = function (input) {
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
-};
-
-// MOMENTS
-
-export var getSetYear = makeGetSet('FullYear', false);
-
-export function getIsLeapYear () {
- return isLeapYear(this.year());
-}