dateUtil.d.ts 2.9 KB

1234567891011121314151617181920212223242526272829
  1. import type { GenerateConfig } from '../generate';
  2. import type { CustomFormat, InternalMode, Locale, NullableDateType } from '../interface';
  3. export declare const WEEK_DAY_COUNT = 7;
  4. export declare function isSameDecade<DateType>(generateConfig: GenerateConfig<DateType>, decade1: NullableDateType<DateType>, decade2: NullableDateType<DateType>): boolean;
  5. export declare function isSameYear<DateType>(generateConfig: GenerateConfig<DateType>, year1: NullableDateType<DateType>, year2: NullableDateType<DateType>): boolean;
  6. export declare function getQuarter<DateType>(generateConfig: GenerateConfig<DateType>, date: DateType): number;
  7. export declare function isSameQuarter<DateType>(generateConfig: GenerateConfig<DateType>, quarter1: NullableDateType<DateType>, quarter2: NullableDateType<DateType>): boolean;
  8. export declare function isSameMonth<DateType>(generateConfig: GenerateConfig<DateType>, month1: NullableDateType<DateType>, month2: NullableDateType<DateType>): boolean;
  9. export declare function isSameDate<DateType>(generateConfig: GenerateConfig<DateType>, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>): boolean;
  10. export declare function isSameTime<DateType>(generateConfig: GenerateConfig<DateType>, time1: NullableDateType<DateType>, time2: NullableDateType<DateType>): boolean;
  11. /**
  12. * Check if the Date is all the same of timestamp
  13. */
  14. export declare function isSameTimestamp<DateType>(generateConfig: GenerateConfig<DateType>, time1: NullableDateType<DateType>, time2: NullableDateType<DateType>): boolean;
  15. export declare function isSameWeek<DateType>(generateConfig: GenerateConfig<DateType>, locale: string, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>): boolean;
  16. export declare function isSame<DateType = any>(generateConfig: GenerateConfig<DateType>, locale: Locale, source: NullableDateType<DateType>, target: NullableDateType<DateType>, type: InternalMode): boolean;
  17. /** Between in date but not equal of date */
  18. export declare function isInRange<DateType>(generateConfig: GenerateConfig<DateType>, startDate: NullableDateType<DateType>, endDate: NullableDateType<DateType>, current: NullableDateType<DateType>): boolean;
  19. export declare function isSameOrAfter<DateType>(generateConfig: GenerateConfig<DateType>, locale: Locale, date1: NullableDateType<DateType>, date2: NullableDateType<DateType>, type: InternalMode): boolean;
  20. export declare function getWeekStartDate<DateType>(locale: string, generateConfig: GenerateConfig<DateType>, value: DateType): DateType;
  21. export declare function formatValue<DateType>(value: DateType, { generateConfig, locale, format, }: {
  22. generateConfig: GenerateConfig<DateType>;
  23. locale: Locale;
  24. format: string | CustomFormat<DateType>;
  25. }): string;
  26. /**
  27. * Fill the time info into Date if provided.
  28. */
  29. export declare function fillTime<DateType>(generateConfig: GenerateConfig<DateType>, date: DateType, time?: DateType): DateType;