import { Assertion } from "./Assertion"; import { DateOptions, DayOfWeek } from "./DateAssertion.types"; /** * Encapsulates assertion methods applicable to values of type Date */ export declare class DateAssertion extends Assertion { constructor(actual: Date); /** * Check if a day of the week equals the day of the actual date. You can pass * either a string (e.g. "monday"), or a number from 0 to 6, where 0 is * Sunday and 6 is Saturday, as in Date.getDay(). * * @example * ``` * const octoberTenth2022 = new Date(2022, 9, 10); * * expect(octoberTenth2022).toBeDayOfWeek("monday"); * expect(octoberTenth2022).toBeDayOfWeek(1); * ``` * * @param dayOfWeek the day to compare with * @returns the assertion instance */ toBeDayOfWeek(dayOfWeek: DayOfWeek | number): this; /** * Check if two dates are equal or partially equal * by using a configuration object that can contain * optional specifications for: year, month, day, hour, * minutes, seconds and milliseconds, equals the actual date. * The test fails when the value of one of the specifications * doesn't match the actual date. * * @example * ``` * const septemberTenth2022 = new Date(2022, 8, 10); * * expect(octoberTenth2022).toMatchDateParts({ * month: "august", // or just `8` * year:2022, * }); * ``` * * @param options the option object to compare with * @returns the assertion instance */ toMatchDateParts(options: DateOptions): this; /** * Check if the actual date comes before the passed date. * * @example * ``` * const septemberFirst2022 = new Date(2022, 8, 1); * const octoberFirst2022 = new Date(2022, 9, 1); * * expect(septemberFirst2022).toBeBefore(octoberFirst2022); * ``` * * @param date the date to compare with * @returns the assertion instance */ toBeBefore(date: Date): this; /** * Check if the actual date comes before or equals the passed date. * * @example * ``` * const septemberFirst2022 = new Date(2022, 8, 1); * const octoberFirst2022 = new Date(2022, 9, 1); * * expect(septemberFirst2022).toBeBeforeOrEqual(octoberFirst2022); * expect(septemberFirst2022).toBeBeforeOrEqual(octoberFirst2022); * ``` * * @param date the date to compare with * @returns the assertion instance */ toBeBeforeOrEqual(date: Date): this; /** * Check if the actual date comes after the passed date. * * @example * ``` * const septemberFirst2022 = new Date(2022, 8, 1); * const octoberFirst2022 = new Date(2022, 9, 1); * * expect(octoberFirst2022).toBeAfter(septemberFirst2022); * ``` * * @param date the date to compare with * @returns the assertion instance */ toBeAfter(date: Date): this; /** * Check if the actual date comes after or equals the passed date. * * @example * ``` * const septemberFirst2022 = new Date(2022, 8, 1); * const octoberFirst2022 = new Date(2022, 9, 1); * * expect(octoberFirst2022).toBeAfterOrEqual(septemberFirst2022); * expect(octoberFirst2022).toBeAfterOrEqual(octoberFirst2022); * ``` * * @param date the date to compare with * @returns the assertion instance */ toBeAfterOrEqual(date: Date): this; }