UNPKG

1.17 kBJavaScriptView Raw
1var protectedDayOfYearTokens = ['D', 'DD'];
2var protectedWeekYearTokens = ['YY', 'YYYY'];
3export function isProtectedDayOfYearToken(token) {
4 return protectedDayOfYearTokens.indexOf(token) !== -1;
5}
6export function isProtectedWeekYearToken(token) {
7 return protectedWeekYearTokens.indexOf(token) !== -1;
8}
9export function throwProtectedError(token, format, input) {
10 if (token === 'YYYY') {
11 throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
12 } else if (token === 'YY') {
13 throw new RangeError("Use `yy` instead of `YY` (in `".concat(format, "`) for formatting years to the input `").concat(input, "`; see: https://git.io/fxCyr"));
14 } else if (token === 'D') {
15 throw new RangeError("Use `d` instead of `D` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
16 } else if (token === 'DD') {
17 throw new RangeError("Use `dd` instead of `DD` (in `".concat(format, "`) for formatting days of the month to the input `").concat(input, "`; see: https://git.io/fxCyr"));
18 }
19}
\No newline at end of file