index.js 1.1 KB

12345678910111213141516171819
  1. var protectedDayOfYearTokens = ['D', 'DD'];
  2. var protectedWeekYearTokens = ['YY', 'YYYY'];
  3. export function isProtectedDayOfYearToken(token) {
  4. return protectedDayOfYearTokens.indexOf(token) !== -1;
  5. }
  6. export function isProtectedWeekYearToken(token) {
  7. return protectedWeekYearTokens.indexOf(token) !== -1;
  8. }
  9. export 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. }