@checkdigit/time 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +72 -0
- package/.github/workflows/codeql-analysis.yml +31 -0
- package/.github/workflows/coverage.yml +46 -0
- package/LICENSE.txt +21 -0
- package/README.md +76 -0
- package/SECURITY.md +14 -0
- package/dist/date-fns/_lib/addLeadingZeros/index.d.ts +1 -0
- package/dist/date-fns/_lib/assign/index.d.ts +1 -0
- package/dist/date-fns/_lib/cloneObject/index.d.ts +1 -0
- package/dist/date-fns/_lib/defaultLocale/index.d.ts +2 -0
- package/dist/date-fns/_lib/defaultOptions/index.d.ts +4 -0
- package/dist/date-fns/_lib/format/formatters/index.d.ts +9 -0
- package/dist/date-fns/_lib/format/lightFormatters/index.d.ts +12 -0
- package/dist/date-fns/_lib/format/longFormatters/index.d.ts +4 -0
- package/dist/date-fns/_lib/getTimezoneOffsetInMilliseconds/index.d.ts +12 -0
- package/dist/date-fns/_lib/protectedTokens/index.d.ts +3 -0
- package/dist/date-fns/_lib/roundingMethods/index.d.ts +2 -0
- package/dist/date-fns/add/index.d.ts +40 -0
- package/dist/date-fns/addBusinessDays/index.d.ts +18 -0
- package/dist/date-fns/addDays/index.d.ts +18 -0
- package/dist/date-fns/addHours/index.d.ts +18 -0
- package/dist/date-fns/addISOWeekYears/index.d.ts +20 -0
- package/dist/date-fns/addMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/addMinutes/index.d.ts +18 -0
- package/dist/date-fns/addMonths/index.d.ts +18 -0
- package/dist/date-fns/addQuarters/index.d.ts +18 -0
- package/dist/date-fns/addSeconds/index.d.ts +18 -0
- package/dist/date-fns/addWeeks/index.d.ts +18 -0
- package/dist/date-fns/addYears/index.d.ts +18 -0
- package/dist/date-fns/areIntervalsOverlapping/index.d.ts +61 -0
- package/dist/date-fns/clamp/index.d.ts +27 -0
- package/dist/date-fns/closestIndexTo/index.d.ts +24 -0
- package/dist/date-fns/closestTo/index.d.ts +22 -0
- package/dist/date-fns/compareAsc/index.d.ts +32 -0
- package/dist/date-fns/compareDesc/index.d.ts +32 -0
- package/dist/date-fns/constants/index.d.ts +211 -0
- package/dist/date-fns/constructFrom/index.d.ts +26 -0
- package/dist/date-fns/daysToWeeks/index.d.ts +23 -0
- package/dist/date-fns/differenceInBusinessDays/index.d.ts +49 -0
- package/dist/date-fns/differenceInCalendarDays/index.d.ts +30 -0
- package/dist/date-fns/differenceInCalendarISOWeekYears/index.d.ts +23 -0
- package/dist/date-fns/differenceInCalendarISOWeeks/index.d.ts +23 -0
- package/dist/date-fns/differenceInCalendarMonths/index.d.ts +21 -0
- package/dist/date-fns/differenceInCalendarQuarters/index.d.ts +21 -0
- package/dist/date-fns/differenceInCalendarWeeks/index.d.ts +38 -0
- package/dist/date-fns/differenceInCalendarYears/index.d.ts +21 -0
- package/dist/date-fns/differenceInDays/index.d.ts +49 -0
- package/dist/date-fns/differenceInHours/index.d.ts +28 -0
- package/dist/date-fns/differenceInISOWeekYears/index.d.ts +23 -0
- package/dist/date-fns/differenceInMilliseconds/index.d.ts +22 -0
- package/dist/date-fns/differenceInMinutes/index.d.ts +36 -0
- package/dist/date-fns/differenceInMonths/index.d.ts +18 -0
- package/dist/date-fns/differenceInQuarters/index.d.ts +25 -0
- package/dist/date-fns/differenceInSeconds/index.d.ts +29 -0
- package/dist/date-fns/differenceInWeeks/index.d.ts +46 -0
- package/dist/date-fns/differenceInYears/index.d.ts +18 -0
- package/dist/date-fns/eachDayOfInterval/index.d.ts +36 -0
- package/dist/date-fns/eachHourOfInterval/index.d.ts +35 -0
- package/dist/date-fns/eachMinuteOfInterval/index.d.ts +35 -0
- package/dist/date-fns/eachMonthOfInterval/index.d.ts +31 -0
- package/dist/date-fns/eachQuarterOfInterval/index.d.ts +27 -0
- package/dist/date-fns/eachWeekOfInterval/index.d.ts +38 -0
- package/dist/date-fns/eachWeekendOfInterval/index.d.ts +28 -0
- package/dist/date-fns/eachWeekendOfMonth/index.d.ts +27 -0
- package/dist/date-fns/eachWeekendOfYear/index.d.ts +24 -0
- package/dist/date-fns/eachYearOfInterval/index.d.ts +28 -0
- package/dist/date-fns/endOfDay/index.d.ts +18 -0
- package/dist/date-fns/endOfDecade/index.d.ts +17 -0
- package/dist/date-fns/endOfHour/index.d.ts +18 -0
- package/dist/date-fns/endOfISOWeek/index.d.ts +20 -0
- package/dist/date-fns/endOfISOWeekYear/index.d.ts +21 -0
- package/dist/date-fns/endOfMinute/index.d.ts +18 -0
- package/dist/date-fns/endOfMonth/index.d.ts +18 -0
- package/dist/date-fns/endOfQuarter/index.d.ts +18 -0
- package/dist/date-fns/endOfSecond/index.d.ts +18 -0
- package/dist/date-fns/endOfToday/index.d.ts +20 -0
- package/dist/date-fns/endOfTomorrow/index.d.ts +20 -0
- package/dist/date-fns/endOfWeek/index.d.ts +30 -0
- package/dist/date-fns/endOfYear/index.d.ts +18 -0
- package/dist/date-fns/endOfYesterday/index.d.ts +20 -0
- package/dist/date-fns/format/index.d.ts +289 -0
- package/dist/date-fns/formatDistance/index.d.ts +85 -0
- package/dist/date-fns/formatDistanceStrict/index.d.ts +85 -0
- package/dist/date-fns/formatDistanceToNow/index.d.ts +89 -0
- package/dist/date-fns/formatDistanceToNowStrict/index.d.ts +76 -0
- package/dist/date-fns/formatDuration/index.d.ts +67 -0
- package/dist/date-fns/formatISO/index.d.ts +40 -0
- package/dist/date-fns/formatISO9075/index.d.ts +40 -0
- package/dist/date-fns/formatISODuration/index.d.ts +26 -0
- package/dist/date-fns/formatRFC3339/index.d.ts +35 -0
- package/dist/date-fns/formatRFC7231/index.d.ts +19 -0
- package/dist/date-fns/formatRelative/index.d.ts +39 -0
- package/dist/date-fns/fp/_lib/convertToFP/index.d.ts +1 -0
- package/dist/date-fns/fp/add/index.d.ts +2 -0
- package/dist/date-fns/fp/addBusinessDays/index.d.ts +2 -0
- package/dist/date-fns/fp/addDays/index.d.ts +2 -0
- package/dist/date-fns/fp/addHours/index.d.ts +2 -0
- package/dist/date-fns/fp/addISOWeekYears/index.d.ts +2 -0
- package/dist/date-fns/fp/addMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/addMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/addMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/addQuarters/index.d.ts +2 -0
- package/dist/date-fns/fp/addSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/addWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/addYears/index.d.ts +2 -0
- package/dist/date-fns/fp/areIntervalsOverlapping/index.d.ts +2 -0
- package/dist/date-fns/fp/areIntervalsOverlappingWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/clamp/index.d.ts +2 -0
- package/dist/date-fns/fp/closestIndexTo/index.d.ts +2 -0
- package/dist/date-fns/fp/closestTo/index.d.ts +2 -0
- package/dist/date-fns/fp/compareAsc/index.d.ts +2 -0
- package/dist/date-fns/fp/compareDesc/index.d.ts +2 -0
- package/dist/date-fns/fp/daysToWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInBusinessDays/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarDays/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarISOWeekYears/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarISOWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarQuarters/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarWeeksWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInCalendarYears/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInDays/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInHours/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInHoursWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInISOWeekYears/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInMinutesWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInQuarters/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInQuartersWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInSecondsWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInWeeksWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/differenceInYears/index.d.ts +2 -0
- package/dist/date-fns/fp/eachDayOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachDayOfIntervalWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/eachHourOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachHourOfIntervalWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/eachMinuteOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachMinuteOfIntervalWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/eachMonthOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachQuarterOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachWeekOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachWeekOfIntervalWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/eachWeekendOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/eachWeekendOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/eachWeekendOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/eachYearOfInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfDay/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfDecade/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfDecadeWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfHour/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfMinute/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfSecond/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/endOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/format/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDistance/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDistanceStrict/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDistanceStrictWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDistanceWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDuration/index.d.ts +2 -0
- package/dist/date-fns/fp/formatDurationWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatISO/index.d.ts +2 -0
- package/dist/date-fns/fp/formatISO9075/index.d.ts +2 -0
- package/dist/date-fns/fp/formatISO9075WithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatISODuration/index.d.ts +2 -0
- package/dist/date-fns/fp/formatISOWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatRFC3339/index.d.ts +2 -0
- package/dist/date-fns/fp/formatRFC3339WithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatRFC7231/index.d.ts +2 -0
- package/dist/date-fns/fp/formatRelative/index.d.ts +2 -0
- package/dist/date-fns/fp/formatRelativeWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/formatWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/fromUnixTime/index.d.ts +2 -0
- package/dist/date-fns/fp/getDate/index.d.ts +2 -0
- package/dist/date-fns/fp/getDay/index.d.ts +2 -0
- package/dist/date-fns/fp/getDayOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/getDaysInMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/getDaysInYear/index.d.ts +2 -0
- package/dist/date-fns/fp/getDecade/index.d.ts +2 -0
- package/dist/date-fns/fp/getHours/index.d.ts +2 -0
- package/dist/date-fns/fp/getISODay/index.d.ts +2 -0
- package/dist/date-fns/fp/getISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/getISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/getISOWeeksInYear/index.d.ts +2 -0
- package/dist/date-fns/fp/getMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/getMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/getMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/getOverlappingDaysInIntervals/index.d.ts +2 -0
- package/dist/date-fns/fp/getQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/getSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/getTime/index.d.ts +2 -0
- package/dist/date-fns/fp/getUnixTime/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeekOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeekOfMonthWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeekYearWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeeksInMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/getWeeksInMonthWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/getYear/index.d.ts +2 -0
- package/dist/date-fns/fp/hoursToMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/hoursToMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/hoursToSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/index.d.ts +255 -0
- package/dist/date-fns/fp/intervalToDuration/index.d.ts +2 -0
- package/dist/date-fns/fp/intlFormat/index.d.ts +2 -0
- package/dist/date-fns/fp/intlFormatDistance/index.d.ts +2 -0
- package/dist/date-fns/fp/intlFormatDistanceWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/isAfter/index.d.ts +2 -0
- package/dist/date-fns/fp/isBefore/index.d.ts +2 -0
- package/dist/date-fns/fp/isDate/index.d.ts +2 -0
- package/dist/date-fns/fp/isEqual/index.d.ts +2 -0
- package/dist/date-fns/fp/isExists/index.d.ts +2 -0
- package/dist/date-fns/fp/isFirstDayOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/isFriday/index.d.ts +2 -0
- package/dist/date-fns/fp/isLastDayOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/isLeapYear/index.d.ts +2 -0
- package/dist/date-fns/fp/isMatch/index.d.ts +2 -0
- package/dist/date-fns/fp/isMatchWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/isMonday/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameDay/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameHour/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameMinute/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameSecond/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/isSameYear/index.d.ts +2 -0
- package/dist/date-fns/fp/isSaturday/index.d.ts +2 -0
- package/dist/date-fns/fp/isSunday/index.d.ts +2 -0
- package/dist/date-fns/fp/isThursday/index.d.ts +2 -0
- package/dist/date-fns/fp/isTuesday/index.d.ts +2 -0
- package/dist/date-fns/fp/isValid/index.d.ts +2 -0
- package/dist/date-fns/fp/isWednesday/index.d.ts +2 -0
- package/dist/date-fns/fp/isWeekend/index.d.ts +2 -0
- package/dist/date-fns/fp/isWithinInterval/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfDecade/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfQuarterWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/lastDayOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/lightFormat/index.d.ts +2 -0
- package/dist/date-fns/fp/max/index.d.ts +2 -0
- package/dist/date-fns/fp/milliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/millisecondsToHours/index.d.ts +2 -0
- package/dist/date-fns/fp/millisecondsToMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/millisecondsToSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/min/index.d.ts +2 -0
- package/dist/date-fns/fp/minutesToHours/index.d.ts +2 -0
- package/dist/date-fns/fp/minutesToMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/minutesToSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/monthsToQuarters/index.d.ts +2 -0
- package/dist/date-fns/fp/monthsToYears/index.d.ts +2 -0
- package/dist/date-fns/fp/nextDay/index.d.ts +2 -0
- package/dist/date-fns/fp/nextFriday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextMonday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextSaturday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextSunday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextThursday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextTuesday/index.d.ts +2 -0
- package/dist/date-fns/fp/nextWednesday/index.d.ts +2 -0
- package/dist/date-fns/fp/parse/index.d.ts +2 -0
- package/dist/date-fns/fp/parseISO/index.d.ts +2 -0
- package/dist/date-fns/fp/parseISOWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/parseJSON/index.d.ts +2 -0
- package/dist/date-fns/fp/parseWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/previousDay/index.d.ts +2 -0
- package/dist/date-fns/fp/previousFriday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousMonday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousSaturday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousSunday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousThursday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousTuesday/index.d.ts +2 -0
- package/dist/date-fns/fp/previousWednesday/index.d.ts +2 -0
- package/dist/date-fns/fp/quartersToMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/quartersToYears/index.d.ts +2 -0
- package/dist/date-fns/fp/roundToNearestMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/roundToNearestMinutesWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/secondsToHours/index.d.ts +2 -0
- package/dist/date-fns/fp/secondsToMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/secondsToMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/set/index.d.ts +2 -0
- package/dist/date-fns/fp/setDate/index.d.ts +2 -0
- package/dist/date-fns/fp/setDay/index.d.ts +2 -0
- package/dist/date-fns/fp/setDayOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/setDayWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/setHours/index.d.ts +2 -0
- package/dist/date-fns/fp/setISODay/index.d.ts +2 -0
- package/dist/date-fns/fp/setISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/setISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/setMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/setMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/setMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/setQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/setSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/setWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/setWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/setWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/setWeekYearWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/setYear/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfDay/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfDecade/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfHour/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfISOWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfISOWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfMinute/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfMonth/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfQuarter/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfSecond/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfWeek/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfWeekWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfWeekYear/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfWeekYearWithOptions/index.d.ts +2 -0
- package/dist/date-fns/fp/startOfYear/index.d.ts +2 -0
- package/dist/date-fns/fp/sub/index.d.ts +2 -0
- package/dist/date-fns/fp/subBusinessDays/index.d.ts +2 -0
- package/dist/date-fns/fp/subDays/index.d.ts +2 -0
- package/dist/date-fns/fp/subHours/index.d.ts +2 -0
- package/dist/date-fns/fp/subISOWeekYears/index.d.ts +2 -0
- package/dist/date-fns/fp/subMilliseconds/index.d.ts +2 -0
- package/dist/date-fns/fp/subMinutes/index.d.ts +2 -0
- package/dist/date-fns/fp/subMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/subQuarters/index.d.ts +2 -0
- package/dist/date-fns/fp/subSeconds/index.d.ts +2 -0
- package/dist/date-fns/fp/subWeeks/index.d.ts +2 -0
- package/dist/date-fns/fp/subYears/index.d.ts +2 -0
- package/dist/date-fns/fp/toDate/index.d.ts +2 -0
- package/dist/date-fns/fp/weeksToDays/index.d.ts +2 -0
- package/dist/date-fns/fp/yearsToMonths/index.d.ts +2 -0
- package/dist/date-fns/fp/yearsToQuarters/index.d.ts +2 -0
- package/dist/date-fns/fromUnixTime/index.d.ts +17 -0
- package/dist/date-fns/getDate/index.d.ts +17 -0
- package/dist/date-fns/getDay/index.d.ts +17 -0
- package/dist/date-fns/getDayOfYear/index.d.ts +17 -0
- package/dist/date-fns/getDaysInMonth/index.d.ts +17 -0
- package/dist/date-fns/getDaysInYear/index.d.ts +17 -0
- package/dist/date-fns/getDecade/index.d.ts +17 -0
- package/dist/date-fns/getDefaultOptions/index.d.ts +26 -0
- package/dist/date-fns/getHours/index.d.ts +17 -0
- package/dist/date-fns/getISODay/index.d.ts +20 -0
- package/dist/date-fns/getISOWeek/index.d.ts +19 -0
- package/dist/date-fns/getISOWeekYear/index.d.ts +20 -0
- package/dist/date-fns/getISOWeeksInYear/index.d.ts +19 -0
- package/dist/date-fns/getMilliseconds/index.d.ts +17 -0
- package/dist/date-fns/getMinutes/index.d.ts +17 -0
- package/dist/date-fns/getMonth/index.d.ts +17 -0
- package/dist/date-fns/getOverlappingDaysInIntervals/index.d.ts +32 -0
- package/dist/date-fns/getQuarter/index.d.ts +17 -0
- package/dist/date-fns/getSeconds/index.d.ts +17 -0
- package/dist/date-fns/getTime/index.d.ts +17 -0
- package/dist/date-fns/getUnixTime/index.d.ts +17 -0
- package/dist/date-fns/getWeek/index.d.ts +39 -0
- package/dist/date-fns/getWeekOfMonth/index.d.ts +24 -0
- package/dist/date-fns/getWeekYear/index.d.ts +40 -0
- package/dist/date-fns/getWeeksInMonth/index.d.ts +30 -0
- package/dist/date-fns/getYear/index.d.ts +17 -0
- package/dist/date-fns/hoursToMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/hoursToMinutes/index.d.ts +18 -0
- package/dist/date-fns/hoursToSeconds/index.d.ts +18 -0
- package/dist/date-fns/index.d.ts +240 -0
- package/dist/date-fns/intervalToDuration/index.d.ts +25 -0
- package/dist/date-fns/intlFormat/index.d.ts +10 -0
- package/dist/date-fns/intlFormatDistance/index.d.ts +107 -0
- package/dist/date-fns/isAfter/index.d.ts +18 -0
- package/dist/date-fns/isBefore/index.d.ts +18 -0
- package/dist/date-fns/isDate/index.d.ts +32 -0
- package/dist/date-fns/isEqual/index.d.ts +21 -0
- package/dist/date-fns/isExists/index.d.ts +24 -0
- package/dist/date-fns/isFirstDayOfMonth/index.d.ts +17 -0
- package/dist/date-fns/isFriday/index.d.ts +17 -0
- package/dist/date-fns/isFuture/index.d.ts +21 -0
- package/dist/date-fns/isLastDayOfMonth/index.d.ts +17 -0
- package/dist/date-fns/isLeapYear/index.d.ts +17 -0
- package/dist/date-fns/isMatch/index.d.ts +291 -0
- package/dist/date-fns/isMonday/index.d.ts +17 -0
- package/dist/date-fns/isPast/index.d.ts +21 -0
- package/dist/date-fns/isSameDay/index.d.ts +28 -0
- package/dist/date-fns/isSameHour/index.d.ts +23 -0
- package/dist/date-fns/isSameISOWeek/index.d.ts +25 -0
- package/dist/date-fns/isSameISOWeekYear/index.d.ts +20 -0
- package/dist/date-fns/isSameMinute/index.d.ts +29 -0
- package/dist/date-fns/isSameMonth/index.d.ts +23 -0
- package/dist/date-fns/isSameQuarter/index.d.ts +23 -0
- package/dist/date-fns/isSameSecond/index.d.ts +37 -0
- package/dist/date-fns/isSameWeek/index.d.ts +38 -0
- package/dist/date-fns/isSameYear/index.d.ts +18 -0
- package/dist/date-fns/isSaturday/index.d.ts +17 -0
- package/dist/date-fns/isSunday/index.d.ts +17 -0
- package/dist/date-fns/isThisHour/index.d.ts +22 -0
- package/dist/date-fns/isThisISOWeek/index.d.ts +23 -0
- package/dist/date-fns/isThisMinute/index.d.ts +22 -0
- package/dist/date-fns/isThisMonth/index.d.ts +21 -0
- package/dist/date-fns/isThisQuarter/index.d.ts +21 -0
- package/dist/date-fns/isThisSecond/index.d.ts +22 -0
- package/dist/date-fns/isThisWeek/index.d.ts +34 -0
- package/dist/date-fns/isThisYear/index.d.ts +21 -0
- package/dist/date-fns/isThursday/index.d.ts +17 -0
- package/dist/date-fns/isToday/index.d.ts +21 -0
- package/dist/date-fns/isTomorrow/index.d.ts +21 -0
- package/dist/date-fns/isTuesday/index.d.ts +17 -0
- package/dist/date-fns/isValid/index.d.ts +31 -0
- package/dist/date-fns/isWednesday/index.d.ts +17 -0
- package/dist/date-fns/isWeekend/index.d.ts +17 -0
- package/dist/date-fns/isWithinInterval/index.d.ts +40 -0
- package/dist/date-fns/isYesterday/index.d.ts +21 -0
- package/dist/date-fns/lastDayOfDecade/index.d.ts +17 -0
- package/dist/date-fns/lastDayOfISOWeek/index.d.ts +20 -0
- package/dist/date-fns/lastDayOfISOWeekYear/index.d.ts +21 -0
- package/dist/date-fns/lastDayOfMonth/index.d.ts +18 -0
- package/dist/date-fns/lastDayOfQuarter/index.d.ts +18 -0
- package/dist/date-fns/lastDayOfWeek/index.d.ts +30 -0
- package/dist/date-fns/lastDayOfYear/index.d.ts +18 -0
- package/dist/date-fns/lightFormat/index.d.ts +1 -0
- package/dist/date-fns/locale/_lib/buildFormatLongFn/index.d.ts +10 -0
- package/dist/date-fns/locale/_lib/buildLocalizeFn/index.d.ts +37 -0
- package/dist/date-fns/locale/_lib/buildMatchFn/index.d.ts +2 -0
- package/dist/date-fns/locale/_lib/buildMatchPatternFn/index.d.ts +7 -0
- package/dist/date-fns/locale/en-US/_lib/formatDistance/index.d.ts +3 -0
- package/dist/date-fns/locale/en-US/_lib/formatLong/index.d.ts +3 -0
- package/dist/date-fns/locale/en-US/_lib/formatRelative/index.d.ts +3 -0
- package/dist/date-fns/locale/en-US/_lib/localize/index.d.ts +3 -0
- package/dist/date-fns/locale/en-US/_lib/match/index.d.ts +3 -0
- package/dist/date-fns/locale/en-US/index.d.ts +12 -0
- package/dist/date-fns/locale/index.d.ts +1 -0
- package/dist/date-fns/locale/types.d.ts +115 -0
- package/dist/date-fns/max/index.d.ts +22 -0
- package/dist/date-fns/milliseconds/index.d.ts +30 -0
- package/dist/date-fns/millisecondsToHours/index.d.ts +23 -0
- package/dist/date-fns/millisecondsToMinutes/index.d.ts +23 -0
- package/dist/date-fns/millisecondsToSeconds/index.d.ts +23 -0
- package/dist/date-fns/min/index.d.ts +22 -0
- package/dist/date-fns/minutesToHours/index.d.ts +23 -0
- package/dist/date-fns/minutesToMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/minutesToSeconds/index.d.ts +18 -0
- package/dist/date-fns/monthsToQuarters/index.d.ts +23 -0
- package/dist/date-fns/monthsToYears/index.d.ts +22 -0
- package/dist/date-fns/nextDay/index.d.ts +24 -0
- package/dist/date-fns/nextFriday/index.d.ts +17 -0
- package/dist/date-fns/nextMonday/index.d.ts +17 -0
- package/dist/date-fns/nextSaturday/index.d.ts +17 -0
- package/dist/date-fns/nextSunday/index.d.ts +17 -0
- package/dist/date-fns/nextThursday/index.d.ts +17 -0
- package/dist/date-fns/nextTuesday/index.d.ts +17 -0
- package/dist/date-fns/nextWednesday/index.d.ts +17 -0
- package/dist/date-fns/parse/_lib/Parser.d.ts +15 -0
- package/dist/date-fns/parse/_lib/Setter.d.ts +21 -0
- package/dist/date-fns/parse/_lib/constants.d.ts +28 -0
- package/dist/date-fns/parse/_lib/parsers/AMPMMidnightParser.d.ts +9 -0
- package/dist/date-fns/parse/_lib/parsers/AMPMParser.d.ts +9 -0
- package/dist/date-fns/parse/_lib/parsers/DateParser.d.ts +11 -0
- package/dist/date-fns/parse/_lib/parsers/DayOfYearParser.d.ts +11 -0
- package/dist/date-fns/parse/_lib/parsers/DayParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/DayPeriodParser.d.ts +9 -0
- package/dist/date-fns/parse/_lib/parsers/EraParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/ExtendedYearParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/FractionOfSecondParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/Hour0To11Parser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/Hour0to23Parser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/Hour1To24Parser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/Hour1to12Parser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/ISODayParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/ISOTimezoneParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/ISOWeekParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/ISOWeekYearParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/LocalDayParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/LocalWeekParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/LocalWeekYearParser.d.ts +11 -0
- package/dist/date-fns/parse/_lib/parsers/MinuteParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/MonthParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/QuarterParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/SecondParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/StandAloneMonthParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/StandAloneQuarterParser.d.ts +10 -0
- package/dist/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/TimestampSecondsParser.d.ts +8 -0
- package/dist/date-fns/parse/_lib/parsers/YearParser.d.ts +14 -0
- package/dist/date-fns/parse/_lib/parsers/index.d.ts +2 -0
- package/dist/date-fns/parse/_lib/types.d.ts +10 -0
- package/dist/date-fns/parse/_lib/utils.d.ts +11 -0
- package/dist/date-fns/parse/index.d.ts +300 -0
- package/dist/date-fns/parseISO/index.d.ts +36 -0
- package/dist/date-fns/parseJSON/index.d.ts +34 -0
- package/dist/date-fns/previousDay/index.d.ts +24 -0
- package/dist/date-fns/previousFriday/index.d.ts +17 -0
- package/dist/date-fns/previousMonday/index.d.ts +17 -0
- package/dist/date-fns/previousSaturday/index.d.ts +17 -0
- package/dist/date-fns/previousSunday/index.d.ts +17 -0
- package/dist/date-fns/previousThursday/index.d.ts +17 -0
- package/dist/date-fns/previousTuesday/index.d.ts +17 -0
- package/dist/date-fns/previousWednesday/index.d.ts +17 -0
- package/dist/date-fns/quartersToMonths/index.d.ts +18 -0
- package/dist/date-fns/quartersToYears/index.d.ts +23 -0
- package/dist/date-fns/roundToNearestMinutes/index.d.ts +33 -0
- package/dist/date-fns/secondsToHours/index.d.ts +23 -0
- package/dist/date-fns/secondsToMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/secondsToMinutes/index.d.ts +23 -0
- package/dist/date-fns/set/index.d.ts +38 -0
- package/dist/date-fns/setDate/index.d.ts +18 -0
- package/dist/date-fns/setDay/index.d.ts +30 -0
- package/dist/date-fns/setDayOfYear/index.d.ts +18 -0
- package/dist/date-fns/setDefaultOptions/index.d.ts +50 -0
- package/dist/date-fns/setHours/index.d.ts +18 -0
- package/dist/date-fns/setISODay/index.d.ts +20 -0
- package/dist/date-fns/setISOWeek/index.d.ts +20 -0
- package/dist/date-fns/setISOWeekYear/index.d.ts +21 -0
- package/dist/date-fns/setMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/setMinutes/index.d.ts +18 -0
- package/dist/date-fns/setMonth/index.d.ts +18 -0
- package/dist/date-fns/setQuarter/index.d.ts +18 -0
- package/dist/date-fns/setSeconds/index.d.ts +18 -0
- package/dist/date-fns/setWeek/index.d.ts +41 -0
- package/dist/date-fns/setWeekYear/index.d.ts +42 -0
- package/dist/date-fns/setYear/index.d.ts +18 -0
- package/dist/date-fns/startOfDay/index.d.ts +18 -0
- package/dist/date-fns/startOfDecade/index.d.ts +17 -0
- package/dist/date-fns/startOfHour/index.d.ts +18 -0
- package/dist/date-fns/startOfISOWeek/index.d.ts +20 -0
- package/dist/date-fns/startOfISOWeekYear/index.d.ts +21 -0
- package/dist/date-fns/startOfMinute/index.d.ts +18 -0
- package/dist/date-fns/startOfMonth/index.d.ts +18 -0
- package/dist/date-fns/startOfQuarter/index.d.ts +18 -0
- package/dist/date-fns/startOfSecond/index.d.ts +18 -0
- package/dist/date-fns/startOfToday/index.d.ts +20 -0
- package/dist/date-fns/startOfTomorrow/index.d.ts +20 -0
- package/dist/date-fns/startOfWeek/index.d.ts +30 -0
- package/dist/date-fns/startOfWeekYear/index.d.ts +40 -0
- package/dist/date-fns/startOfYear/index.d.ts +18 -0
- package/dist/date-fns/startOfYesterday/index.d.ts +20 -0
- package/dist/date-fns/sub/index.d.ts +40 -0
- package/dist/date-fns/subBusinessDays/index.d.ts +18 -0
- package/dist/date-fns/subDays/index.d.ts +18 -0
- package/dist/date-fns/subHours/index.d.ts +18 -0
- package/dist/date-fns/subISOWeekYears/index.d.ts +20 -0
- package/dist/date-fns/subMilliseconds/index.d.ts +18 -0
- package/dist/date-fns/subMinutes/index.d.ts +18 -0
- package/dist/date-fns/subMonths/index.d.ts +18 -0
- package/dist/date-fns/subQuarters/index.d.ts +18 -0
- package/dist/date-fns/subSeconds/index.d.ts +18 -0
- package/dist/date-fns/subWeeks/index.d.ts +18 -0
- package/dist/date-fns/subYears/index.d.ts +18 -0
- package/dist/date-fns/toDate/index.d.ts +31 -0
- package/dist/date-fns/transpose/index.d.ts +25 -0
- package/dist/date-fns/types.d.ts +70 -0
- package/dist/date-fns/weeksToDays/index.d.ts +18 -0
- package/dist/date-fns/yearsToMonths/index.d.ts +18 -0
- package/dist/date-fns/yearsToQuarters/index.d.ts +18 -0
- package/dist/date-fns-tz/_lib/newDateUTC/index.d.ts +8 -0
- package/dist/date-fns-tz/_lib/tzIntlTimeZoneName/index.d.ts +10 -0
- package/dist/date-fns-tz/_lib/tzParseTimezone/index.d.ts +1 -0
- package/dist/date-fns-tz/_lib/tzPattern/index.d.ts +3 -0
- package/dist/date-fns-tz/_lib/tzTokenizeDate/index.d.ts +5 -0
- package/dist/date-fns-tz/format/formatters/index.d.ts +19 -0
- package/dist/date-fns-tz/format/index.d.ts +312 -0
- package/dist/date-fns-tz/formatInTimeZone/index.d.ts +24 -0
- package/dist/date-fns-tz/getTimezoneOffset/index.d.ts +28 -0
- package/dist/date-fns-tz/index.d.ts +6 -0
- package/dist/date-fns-tz/toDate/index.d.ts +43 -0
- package/dist/date-fns-tz/types.d.ts +13 -0
- package/dist/date-fns-tz/utcToZonedTime/index.d.ts +26 -0
- package/dist/date-fns-tz/zonedTimeToUtc/index.d.ts +26 -0
- package/dist/format-utc.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/instant.d.ts +28 -0
- package/dist/now.d.ts +9 -0
- package/dist/temporal.d.ts +2 -0
- package/package.json +55 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { LocaleOptions, FormatDistanceStrictUnit } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatDistanceStrict} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatDistanceStrictOptions extends LocaleOptions {
|
|
6
|
+
addSuffix?: boolean;
|
|
7
|
+
unit?: FormatDistanceStrictUnit;
|
|
8
|
+
roundingMethod?: 'floor' | 'ceil' | 'round';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @name formatDistanceStrict
|
|
12
|
+
* @category Common Helpers
|
|
13
|
+
* @summary Return the distance between the given dates in words.
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* Return the distance between the given dates in words, using strict units.
|
|
17
|
+
* This is like `formatDistance`, but does not use helpers like 'almost', 'over',
|
|
18
|
+
* 'less than' and the like.
|
|
19
|
+
*
|
|
20
|
+
* | Distance between dates | Result |
|
|
21
|
+
* |------------------------|---------------------|
|
|
22
|
+
* | 0 ... 59 secs | [0..59] seconds |
|
|
23
|
+
* | 1 ... 59 mins | [1..59] minutes |
|
|
24
|
+
* | 1 ... 23 hrs | [1..23] hours |
|
|
25
|
+
* | 1 ... 29 days | [1..29] days |
|
|
26
|
+
* | 1 ... 11 months | [1..11] months |
|
|
27
|
+
* | 1 ... N years | [1..N] years |
|
|
28
|
+
*
|
|
29
|
+
* @param date - the date
|
|
30
|
+
* @param baseDate - the date to compare with
|
|
31
|
+
* @param options - an object with options.
|
|
32
|
+
* @returns the distance in words
|
|
33
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
34
|
+
* @throws {RangeError} `baseDate` must not be Invalid Date
|
|
35
|
+
* @throws {RangeError} `options.unit` must be 'second', 'minute', 'hour', 'day', 'month' or 'year'
|
|
36
|
+
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // What is the distance between 2 July 2014 and 1 January 2015?
|
|
40
|
+
* const result = formatDistanceStrict(new Date(2014, 6, 2), new Date(2015, 0, 2))
|
|
41
|
+
* //=> '6 months'
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // What is the distance between 1 January 2015 00:00:15
|
|
45
|
+
* // and 1 January 2015 00:00:00?
|
|
46
|
+
* const result = formatDistanceStrict(
|
|
47
|
+
* new Date(2015, 0, 1, 0, 0, 15),
|
|
48
|
+
* new Date(2015, 0, 1, 0, 0, 0)
|
|
49
|
+
* )
|
|
50
|
+
* //=> '15 seconds'
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* // What is the distance from 1 January 2016
|
|
54
|
+
* // to 1 January 2015, with a suffix?
|
|
55
|
+
* const result = formatDistanceStrict(new Date(2015, 0, 1), new Date(2016, 0, 1), {
|
|
56
|
+
* addSuffix: true
|
|
57
|
+
* })
|
|
58
|
+
* //=> '1 year ago'
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // What is the distance from 1 January 2016
|
|
62
|
+
* // to 1 January 2015, in minutes?
|
|
63
|
+
* const result = formatDistanceStrict(new Date(2016, 0, 1), new Date(2015, 0, 1), {
|
|
64
|
+
* unit: 'minute'
|
|
65
|
+
* })
|
|
66
|
+
* //=> '525600 minutes'
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // What is the distance from 1 January 2015
|
|
70
|
+
* // to 28 January 2015, in months, rounded up?
|
|
71
|
+
* const result = formatDistanceStrict(new Date(2015, 0, 28), new Date(2015, 0, 1), {
|
|
72
|
+
* unit: 'month',
|
|
73
|
+
* roundingMethod: 'ceil'
|
|
74
|
+
* })
|
|
75
|
+
* //=> '1 month'
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
|
|
79
|
+
* import { eoLocale } from 'date-fns/locale/eo'
|
|
80
|
+
* const result = formatDistanceStrict(new Date(2016, 7, 1), new Date(2015, 0, 1), {
|
|
81
|
+
* locale: eoLocale
|
|
82
|
+
* })
|
|
83
|
+
* //=> '1 jaro'
|
|
84
|
+
*/
|
|
85
|
+
export default function formatDistanceStrict<DateType extends Date>(dirtyDate: DateType | number, dirtyBaseDate: DateType | number, options?: FormatDistanceStrictOptions): string;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { FormatDistanceOptions } from '../formatDistance/index';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatDistanceToNow} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatDistanceToNowOptions extends FormatDistanceOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatDistanceToNow
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Return the distance between the given date and now in words.
|
|
11
|
+
* @pure false
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Return the distance between the given date and now in words.
|
|
15
|
+
*
|
|
16
|
+
* | Distance to now | Result |
|
|
17
|
+
* |-------------------------------------------------------------------|---------------------|
|
|
18
|
+
* | 0 ... 30 secs | less than a minute |
|
|
19
|
+
* | 30 secs ... 1 min 30 secs | 1 minute |
|
|
20
|
+
* | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
|
|
21
|
+
* | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
|
|
22
|
+
* | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
|
|
23
|
+
* | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
|
|
24
|
+
* | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
|
|
25
|
+
* | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
|
|
26
|
+
* | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
|
|
27
|
+
* | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
|
|
28
|
+
* | 1 yr ... 1 yr 3 months | about 1 year |
|
|
29
|
+
* | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
|
|
30
|
+
* | 1 yr 9 months ... 2 yrs | almost 2 years |
|
|
31
|
+
* | N yrs ... N yrs 3 months | about N years |
|
|
32
|
+
* | N yrs 3 months ... N yrs 9 months | over N years |
|
|
33
|
+
* | N yrs 9 months ... N+1 yrs | almost N+1 years |
|
|
34
|
+
*
|
|
35
|
+
* With `options.includeSeconds == true`:
|
|
36
|
+
* | Distance to now | Result |
|
|
37
|
+
* |---------------------|----------------------|
|
|
38
|
+
* | 0 secs ... 5 secs | less than 5 seconds |
|
|
39
|
+
* | 5 secs ... 10 secs | less than 10 seconds |
|
|
40
|
+
* | 10 secs ... 20 secs | less than 20 seconds |
|
|
41
|
+
* | 20 secs ... 40 secs | half a minute |
|
|
42
|
+
* | 40 secs ... 60 secs | less than a minute |
|
|
43
|
+
* | 60 secs ... 90 secs | 1 minute |
|
|
44
|
+
*
|
|
45
|
+
* > ⚠️ Please note that this function is not present in the FP submodule as
|
|
46
|
+
* > it uses `Date.now()` internally hence impure and can't be safely curried.
|
|
47
|
+
*
|
|
48
|
+
* @param date - the given date
|
|
49
|
+
* @param options - the object with options
|
|
50
|
+
* @returns the distance in words
|
|
51
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
52
|
+
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* // If today is 1 January 2015, what is the distance to 2 July 2014?
|
|
56
|
+
* const result = formatDistanceToNow(
|
|
57
|
+
* new Date(2014, 6, 2)
|
|
58
|
+
* )
|
|
59
|
+
* //=> '6 months'
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // If now is 1 January 2015 00:00:00,
|
|
63
|
+
* // what is the distance to 1 January 2015 00:00:15, including seconds?
|
|
64
|
+
* const result = formatDistanceToNow(
|
|
65
|
+
* new Date(2015, 0, 1, 0, 0, 15),
|
|
66
|
+
* {includeSeconds: true}
|
|
67
|
+
* )
|
|
68
|
+
* //=> 'less than 20 seconds'
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* // If today is 1 January 2015,
|
|
72
|
+
* // what is the distance to 1 January 2016, with a suffix?
|
|
73
|
+
* const result = formatDistanceToNow(
|
|
74
|
+
* new Date(2016, 0, 1),
|
|
75
|
+
* {addSuffix: true}
|
|
76
|
+
* )
|
|
77
|
+
* //=> 'in about 1 year'
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* // If today is 1 January 2015,
|
|
81
|
+
* // what is the distance to 1 August 2016 in Esperanto?
|
|
82
|
+
* const eoLocale = require('date-fns/locale/eo')
|
|
83
|
+
* const result = formatDistanceToNow(
|
|
84
|
+
* new Date(2016, 7, 1),
|
|
85
|
+
* {locale: eoLocale}
|
|
86
|
+
* )
|
|
87
|
+
* //=> 'pli ol 1 jaro'
|
|
88
|
+
*/
|
|
89
|
+
export default function formatDistanceToNow<DateType extends Date>(dirtyDate: DateType | number, options?: FormatDistanceToNowOptions): string;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { FormatDistanceStrictOptions } from '../formatDistanceStrict/index';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatDistanceToNowStrict} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatDistanceToNowStrictOptions extends FormatDistanceStrictOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatDistanceToNowStrict
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Return the distance between the given date and now in words.
|
|
11
|
+
* @pure false
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Return the distance between the given dates in words, using strict units.
|
|
15
|
+
* This is like `formatDistance`, but does not use helpers like 'almost', 'over',
|
|
16
|
+
* 'less than' and the like.
|
|
17
|
+
*
|
|
18
|
+
* | Distance between dates | Result |
|
|
19
|
+
* |------------------------|---------------------|
|
|
20
|
+
* | 0 ... 59 secs | [0..59] seconds |
|
|
21
|
+
* | 1 ... 59 mins | [1..59] minutes |
|
|
22
|
+
* | 1 ... 23 hrs | [1..23] hours |
|
|
23
|
+
* | 1 ... 29 days | [1..29] days |
|
|
24
|
+
* | 1 ... 11 months | [1..11] months |
|
|
25
|
+
* | 1 ... N years | [1..N] years |
|
|
26
|
+
*
|
|
27
|
+
* @param date - the given date
|
|
28
|
+
* @param options - an object with options.
|
|
29
|
+
* @returns the distance in words
|
|
30
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
31
|
+
* @throws {RangeError} `options.locale` must contain `formatDistance` property
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // If today is 1 January 2015, what is the distance to 2 July 2014?
|
|
35
|
+
* const result = formatDistanceToNowStrict(
|
|
36
|
+
* new Date(2014, 6, 2)
|
|
37
|
+
* )
|
|
38
|
+
* //=> '6 months'
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // If now is 1 January 2015 00:00:00,
|
|
42
|
+
* // what is the distance to 1 January 2015 00:00:15, including seconds?
|
|
43
|
+
* const result = formatDistanceToNowStrict(
|
|
44
|
+
* new Date(2015, 0, 1, 0, 0, 15)
|
|
45
|
+
* )
|
|
46
|
+
* //=> '15 seconds'
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* // If today is 1 January 2015,
|
|
50
|
+
* // what is the distance to 1 January 2016, with a suffix?
|
|
51
|
+
* const result = formatDistanceToNowStrict(
|
|
52
|
+
* new Date(2016, 0, 1),
|
|
53
|
+
* {addSuffix: true}
|
|
54
|
+
* )
|
|
55
|
+
* //=> 'in 1 year'
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // If today is 28 January 2015,
|
|
59
|
+
* // what is the distance to 1 January 2015, in months, rounded up??
|
|
60
|
+
* const result = formatDistanceToNowStrict(new Date(2015, 0, 1), {
|
|
61
|
+
* unit: 'month',
|
|
62
|
+
* roundingMethod: 'ceil'
|
|
63
|
+
* })
|
|
64
|
+
* //=> '1 month'
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* // If today is 1 January 2015,
|
|
68
|
+
* // what is the distance to 1 January 2016 in Esperanto?
|
|
69
|
+
* const eoLocale = require('date-fns/locale/eo')
|
|
70
|
+
* const result = formatDistanceToNowStrict(
|
|
71
|
+
* new Date(2016, 0, 1),
|
|
72
|
+
* {locale: eoLocale}
|
|
73
|
+
* )
|
|
74
|
+
* //=> '1 jaro'
|
|
75
|
+
*/
|
|
76
|
+
export default function formatDistanceToNowStrict<DateType extends Date>(dirtyDate: DateType | number, options?: FormatDistanceToNowStrictOptions): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Duration, DurationUnit, LocaleOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatDuration} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatDurationOptions extends LocaleOptions {
|
|
6
|
+
format?: DurationUnit[];
|
|
7
|
+
zero?: boolean;
|
|
8
|
+
delimiter?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* @name formatDuration
|
|
12
|
+
* @category Common Helpers
|
|
13
|
+
* @summary Formats a duration in human-readable format
|
|
14
|
+
*
|
|
15
|
+
* @description
|
|
16
|
+
* Return human-readable duration string i.e. "9 months 2 days"
|
|
17
|
+
*
|
|
18
|
+
* @param duration - the duration to format
|
|
19
|
+
* @param options - an object with options.
|
|
20
|
+
* @returns the formatted date string
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Format full duration
|
|
24
|
+
* formatDuration({
|
|
25
|
+
* years: 2,
|
|
26
|
+
* months: 9,
|
|
27
|
+
* weeks: 1,
|
|
28
|
+
* days: 7,
|
|
29
|
+
* hours: 5,
|
|
30
|
+
* minutes: 9,
|
|
31
|
+
* seconds: 30
|
|
32
|
+
* })
|
|
33
|
+
* //=> '2 years 9 months 1 week 7 days 5 hours 9 minutes 30 seconds'
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Format partial duration
|
|
37
|
+
* formatDuration({ months: 9, days: 2 })
|
|
38
|
+
* //=> '9 months 2 days'
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Customize the format
|
|
42
|
+
* formatDuration(
|
|
43
|
+
* {
|
|
44
|
+
* years: 2,
|
|
45
|
+
* months: 9,
|
|
46
|
+
* weeks: 1,
|
|
47
|
+
* days: 7,
|
|
48
|
+
* hours: 5,
|
|
49
|
+
* minutes: 9,
|
|
50
|
+
* seconds: 30
|
|
51
|
+
* },
|
|
52
|
+
* { format: ['months', 'weeks'] }
|
|
53
|
+
* ) === '9 months 1 week'
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* // Customize the zeros presence
|
|
57
|
+
* formatDuration({ years: 0, months: 9 })
|
|
58
|
+
* //=> '9 months'
|
|
59
|
+
* formatDuration({ years: 0, months: 9 }, { zero: true })
|
|
60
|
+
* //=> '0 years 9 months'
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* // Customize the delimiter
|
|
64
|
+
* formatDuration({ years: 2, months: 9, weeks: 3 }, { delimiter: ', ' })
|
|
65
|
+
* //=> '2 years, 9 months, 3 weeks'
|
|
66
|
+
*/
|
|
67
|
+
export default function formatDuration(duration: Duration, options?: FormatDurationOptions): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { FormatOptions, RepresentationOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatISO} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatISOOptions extends FormatOptions, RepresentationOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatISO
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Format the date according to the ISO 8601 standard (https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a003169814.htm).
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Return the formatted date string in ISO 8601 format. Options may be passed to control the parts and notations of the date.
|
|
14
|
+
*
|
|
15
|
+
* @param date - the original date
|
|
16
|
+
* @param options - an object with options.
|
|
17
|
+
* @returns the formatted date string (in local time zone)
|
|
18
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Represent 18 September 2019 in ISO 8601 format (local time zone is UTC):
|
|
22
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52))
|
|
23
|
+
* //=> '2019-09-18T19:00:52Z'
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Represent 18 September 2019 in ISO 8601, short format (local time zone is UTC):
|
|
27
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
|
28
|
+
* //=> '20190918T190052'
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Represent 18 September 2019 in ISO 8601 format, date only:
|
|
32
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
|
33
|
+
* //=> '2019-09-18'
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Represent 18 September 2019 in ISO 8601 format, time only (local time zone is UTC):
|
|
37
|
+
* const result = formatISO(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
|
38
|
+
* //=> '19:00:52Z'
|
|
39
|
+
*/
|
|
40
|
+
export default function formatISO<DateType extends Date>(date: DateType | number, options?: FormatISOOptions): string;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { FormatOptions, RepresentationOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatISO9075} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatISO9075Options extends FormatOptions, RepresentationOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatISO9075
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Format the date according to the ISO 9075 standard (https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_get-format).
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Return the formatted date string in ISO 9075 format. Options may be passed to control the parts and notations of the date.
|
|
14
|
+
*
|
|
15
|
+
* @param date - the original date
|
|
16
|
+
* @param options - an object with options.
|
|
17
|
+
* @returns the formatted date string
|
|
18
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Represent 18 September 2019 in ISO 9075 format:
|
|
22
|
+
* const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52))
|
|
23
|
+
* //=> '2019-09-18 19:00:52'
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Represent 18 September 2019 in ISO 9075, short format:
|
|
27
|
+
* const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
|
|
28
|
+
* //=> '20190918 190052'
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Represent 18 September 2019 in ISO 9075 format, date only:
|
|
32
|
+
* const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
|
|
33
|
+
* //=> '2019-09-18'
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // Represent 18 September 2019 in ISO 9075 format, time only:
|
|
37
|
+
* const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
|
|
38
|
+
* //=> '19:00:52'
|
|
39
|
+
*/
|
|
40
|
+
export default function formatISO9075<DateType extends Date>(dirtyDate: DateType | number, options?: FormatISO9075Options): string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Duration } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @name formatISODuration
|
|
4
|
+
* @category Common Helpers
|
|
5
|
+
* @summary Format a duration object according as ISO 8601 duration string
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* Format a duration object according to the ISO 8601 duration standard (https://www.digi.com/resources/documentation/digidocs/90001437-13/reference/r_iso_8601_duration_format.htm)
|
|
9
|
+
*
|
|
10
|
+
* @param duration - the duration to format
|
|
11
|
+
*
|
|
12
|
+
* @returns The ISO 8601 duration string
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Format the given duration as ISO 8601 string
|
|
16
|
+
* const result = formatISODuration({
|
|
17
|
+
* years: 39,
|
|
18
|
+
* months: 2,
|
|
19
|
+
* days: 20,
|
|
20
|
+
* hours: 7,
|
|
21
|
+
* minutes: 5,
|
|
22
|
+
* seconds: 0
|
|
23
|
+
* })
|
|
24
|
+
* //=> 'P39Y2M20DT0H0M0S'
|
|
25
|
+
*/
|
|
26
|
+
export default function formatISODuration(duration: Duration): string;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The {@link formatRFC3339} function options.
|
|
3
|
+
*/
|
|
4
|
+
export interface FormatRFC3339Options {
|
|
5
|
+
fractionDigits?: 0 | 1 | 2 | 3;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatRFC3339
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Format the date according to the RFC 3339 standard (https://tools.ietf.org/html/rfc3339#section-5.6).
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Return the formatted date string in RFC 3339 format. Options may be passed to control the parts and notations of the date.
|
|
14
|
+
*
|
|
15
|
+
* @param date - the original date
|
|
16
|
+
* @param options - an object with options.
|
|
17
|
+
* @returns the formatted date string
|
|
18
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Represent 18 September 2019 in RFC 3339 format:
|
|
22
|
+
* const result = formatRFC3339(new Date(2019, 8, 18, 19, 0, 52))
|
|
23
|
+
* //=> '2019-09-18T19:00:52Z'
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Represent 18 September 2019 in RFC 3339 format, 2 digits of second fraction:
|
|
27
|
+
* const result = formatRFC3339(new Date(2019, 8, 18, 19, 0, 52, 234), { fractionDigits: 2 })
|
|
28
|
+
* //=> '2019-09-18T19:00:52.23Z'
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Represent 18 September 2019 in RFC 3339 format, 3 digits of second fraction
|
|
32
|
+
* const result = formatRFC3339(new Date(2019, 8, 18, 19, 0, 52, 234), { fractionDigits: 3 })
|
|
33
|
+
* //=> '2019-09-18T19:00:52.234Z'
|
|
34
|
+
*/
|
|
35
|
+
export default function formatRFC3339<DateType extends Date>(dirtyDate: DateType | number, options?: FormatRFC3339Options): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name formatRFC7231
|
|
3
|
+
* @category Common Helpers
|
|
4
|
+
* @summary Format the date according to the RFC 7231 standard (https://tools.ietf.org/html/rfc7231#section-7.1.1.1).
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Return the formatted date string in RFC 7231 format.
|
|
8
|
+
* The result will always be in UTC timezone.
|
|
9
|
+
*
|
|
10
|
+
* @param date - the original date
|
|
11
|
+
* @returns the formatted date string
|
|
12
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Represent 18 September 2019 in RFC 7231 format:
|
|
16
|
+
* const result = formatRFC7231(new Date(2019, 8, 18, 19, 0, 52))
|
|
17
|
+
* //=> 'Wed, 18 Sep 2019 19:00:52 GMT'
|
|
18
|
+
*/
|
|
19
|
+
export default function formatRFC7231<DateType extends Date>(dirtyDate: DateType | number): string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { LocaleOptions, WeekStartOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link formatRelative} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface FormatRelativeOptions extends LocaleOptions, WeekStartOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name formatRelative
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Represent the date in words relative to the given base date.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Represent the date in words relative to the given base date.
|
|
14
|
+
*
|
|
15
|
+
* | Distance to the base date | Result |
|
|
16
|
+
* |---------------------------|---------------------------|
|
|
17
|
+
* | Previous 6 days | last Sunday at 04:30 AM |
|
|
18
|
+
* | Last day | yesterday at 04:30 AM |
|
|
19
|
+
* | Same day | today at 04:30 AM |
|
|
20
|
+
* | Next day | tomorrow at 04:30 AM |
|
|
21
|
+
* | Next 6 days | Sunday at 04:30 AM |
|
|
22
|
+
* | Other | 12/31/2017 |
|
|
23
|
+
*
|
|
24
|
+
* @param date - the date to format
|
|
25
|
+
* @param baseDate - the date to compare with
|
|
26
|
+
* @param options - an object with options.
|
|
27
|
+
* @returns the date in words
|
|
28
|
+
* @throws {RangeError} `date` must not be Invalid Date
|
|
29
|
+
* @throws {RangeError} `baseDate` must not be Invalid Date
|
|
30
|
+
* @throws {RangeError} `options.locale` must contain `localize` property
|
|
31
|
+
* @throws {RangeError} `options.locale` must contain `formatLong` property
|
|
32
|
+
* @throws {RangeError} `options.locale` must contain `formatRelative` property
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Represent the date of 6 days ago in words relative to the given base date. In this example, today is Wednesday
|
|
36
|
+
* const result = formatRelative(addDays(new Date(), -6), new Date())
|
|
37
|
+
* //=> "last Thursday at 12:45 AM"
|
|
38
|
+
*/
|
|
39
|
+
export default function formatRelative<DateType extends Date>(dirtyDate: DateType | number, dirtyBaseDate: DateType | number, options?: FormatRelativeOptions): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function convertToFP(fn: Function, arity: number, a?: any[]): any;
|