calendar.d.ts 806 B

123456789101112131415
  1. import { Locale } from '../locale/locale.class';
  2. import { DateInput } from '../test/chain';
  3. import { DateParsingConfig } from '../create/parsing.types';
  4. export declare type CalendarSpecVal = string | ((m?: DateInput, now?: Date) => string);
  5. export interface CalendarSpec {
  6. sameDay?: CalendarSpecVal;
  7. nextDay?: CalendarSpecVal;
  8. lastDay?: CalendarSpecVal;
  9. nextWeek?: CalendarSpecVal;
  10. lastWeek?: CalendarSpecVal;
  11. sameElse?: CalendarSpecVal;
  12. [x: string]: CalendarSpecVal | void;
  13. }
  14. export declare function getCalendarFormat(date: Date, now: Date, config: DateParsingConfig): "sameElse" | "lastWeek" | "lastDay" | "sameDay" | "nextDay" | "nextWeek";
  15. export declare function calendar(date: Date, time: Date, formats: CalendarSpec, locale?: Locale, config?: DateParsingConfig): string;