Parser.d.cts 933 B

12345678910111213141516171819202122232425262728293031323334
  1. import type { Match } from "../../locale/types.js";
  2. import { ValueSetter } from "./Setter.js";
  3. import type { ParseFlags, ParseResult, ParserOptions } from "./types.js";
  4. export declare abstract class Parser<Value> {
  5. abstract incompatibleTokens: string[] | "*";
  6. abstract priority: number;
  7. subPriority?: number;
  8. run(
  9. dateString: string,
  10. token: string,
  11. match: Match,
  12. options: ParserOptions,
  13. ): {
  14. setter: ValueSetter<Value>;
  15. rest: string;
  16. } | null;
  17. protected abstract parse(
  18. dateString: string,
  19. token: string,
  20. match: Match,
  21. options: ParserOptions,
  22. ): ParseResult<Value>;
  23. protected validate<DateType extends Date>(
  24. _utcDate: DateType,
  25. _value: Value,
  26. _options: ParserOptions,
  27. ): boolean;
  28. protected abstract set<DateType extends Date>(
  29. date: DateType,
  30. flags: ParseFlags,
  31. value: Value,
  32. options: ParserOptions,
  33. ): DateType | [DateType, ParseFlags];
  34. }