Skip to main content

Type Alias: DateLib

DateLib: {addDays: typeof addDays;addMonths: typeof addMonths;addWeeks: typeof addWeeks;addYears: typeof addYears;Date: DateConstructor;differenceInCalendarDays: typeof differenceInCalendarDays;differenceInCalendarMonths: typeof differenceInCalendarMonths;endOfISOWeek: typeof endOfISOWeek;endOfMonth: typeof endOfMonth;endOfWeek: typeof endOfWeek;endOfYear: typeof endOfYear;format: typeof format;getISOWeek: typeof getISOWeek;getWeek: typeof getWeek;isAfter: typeof isAfter;isBefore: typeof isBefore;isDate: typeof isDate;isSameDay: typeof isSameDay;isSameMonth: typeof isSameMonth;isSameYear: typeof isSameYear;max: typeof max;min: typeof min;setMonth: typeof setMonth;setYear: typeof setYear;startOfDay: typeof startOfDay;startOfISOWeek: typeof startOfISOWeek;startOfMonth: typeof startOfMonth;startOfWeek: typeof startOfWeek;startOfYear: typeof startOfYear; }

The date library used by DayPicker. It's a subset of the date-fns functions plus an optional Date constructor.

Override the default date library with the dateLib prop.

Type declaration​

NameTypeDescription
addDaystypeof addDaysAdds the specified number of days to the given date.
addMonthstypeof addMonthsAdds the specified number of months to the given date.
addWeekstypeof addWeeksAdds the specified number of weeks to the given date.
addYearstypeof addYearsAdds the specified number of years to the given date.
Date?DateConstructorThe constructor of the date object.
differenceInCalendarDaystypeof differenceInCalendarDaysReturns the number of calendar days between the given dates.
differenceInCalendarMonthstypeof differenceInCalendarMonthsReturns the number of calendar months between the given dates.
endOfISOWeektypeof endOfISOWeekReturns the end of an ISO week for the given date.
endOfMonthtypeof endOfMonthReturns the end of the month for the given date.
endOfWeektypeof endOfWeekReturns the end of the week for the given date.
endOfYeartypeof endOfYearReturns the end of the year for the given date.
formattypeof formatFormats the given date using the specified format string.
getISOWeektypeof getISOWeekReturns the ISO week number for the given date.
getWeektypeof getWeekReturns the week number for the given date.
isAftertypeof isAfterChecks if the first date is after the second date.
isBeforetypeof isBeforeChecks if the first date is before the second date.
isDatetypeof isDateChecks if the given value is a date.
isSameDaytypeof isSameDayChecks if the given dates are the same day.
isSameMonthtypeof isSameMonthChecks if the given dates are in the same month.
isSameYeartypeof isSameYearChecks if the given dates are in the same year.
maxtypeof maxReturns the maximum of the given dates.
mintypeof minReturns the minimum of the given dates.
setMonthtypeof setMonthSets the month for the given date.
setYeartypeof setYearSets the year for the given date.
startOfDaytypeof startOfDayReturns the start of the day for the given date.
startOfISOWeektypeof startOfISOWeekReturns the start of an ISO week for the given date.
startOfMonthtypeof startOfMonthReturns the start of the month for the given date.
startOfWeektypeof startOfWeekReturns the start of the week for the given date.
startOfYeartypeof startOfYearReturns the start of the year for the given date.

Defined in​

src/lib/dateLib.ts:51