@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,300 @@
|
|
|
1
|
+
import type { AdditionalTokensOptions, FirstWeekContainsDateOptions, LocaleOptions, WeekStartOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link parse} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface ParseOptions extends LocaleOptions, FirstWeekContainsDateOptions, WeekStartOptions, AdditionalTokensOptions {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name parse
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Parse the date.
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Return the date parsed from string using the given format string.
|
|
14
|
+
*
|
|
15
|
+
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
|
|
16
|
+
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
17
|
+
*
|
|
18
|
+
* The characters in the format string wrapped between two single quotes characters (') are escaped.
|
|
19
|
+
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
|
|
20
|
+
*
|
|
21
|
+
* Format of the format string is based on Unicode Technical Standard #35:
|
|
22
|
+
* https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
|
|
23
|
+
* with a few additions (see note 5 below the table).
|
|
24
|
+
*
|
|
25
|
+
* Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
|
|
26
|
+
* and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
|
|
27
|
+
*
|
|
28
|
+
* ```javascript
|
|
29
|
+
* parse('23 AM', 'HH a', new Date())
|
|
30
|
+
* //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
|
|
34
|
+
*
|
|
35
|
+
* Accepted format string patterns:
|
|
36
|
+
* | Unit |Prior| Pattern | Result examples | Notes |
|
|
37
|
+
* |---------------------------------|-----|---------|-----------------------------------|-------|
|
|
38
|
+
* | Era | 140 | G..GGG | AD, BC | |
|
|
39
|
+
* | | | GGGG | Anno Domini, Before Christ | 2 |
|
|
40
|
+
* | | | GGGGG | A, B | |
|
|
41
|
+
* | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
|
|
42
|
+
* | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
43
|
+
* | | | yy | 44, 01, 00, 17 | 4 |
|
|
44
|
+
* | | | yyy | 044, 001, 123, 999 | 4 |
|
|
45
|
+
* | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
|
|
46
|
+
* | | | yyyyy | ... | 2,4 |
|
|
47
|
+
* | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
|
|
48
|
+
* | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
|
|
49
|
+
* | | | YY | 44, 01, 00, 17 | 4,6 |
|
|
50
|
+
* | | | YYY | 044, 001, 123, 999 | 4 |
|
|
51
|
+
* | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
|
|
52
|
+
* | | | YYYYY | ... | 2,4 |
|
|
53
|
+
* | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
|
|
54
|
+
* | | | RR | -43, 01, 00, 17 | 4,5 |
|
|
55
|
+
* | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
|
|
56
|
+
* | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
|
|
57
|
+
* | | | RRRRR | ... | 2,4,5 |
|
|
58
|
+
* | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
|
|
59
|
+
* | | | uu | -43, 01, 99, -99 | 4 |
|
|
60
|
+
* | | | uuu | -043, 001, 123, 999, -999 | 4 |
|
|
61
|
+
* | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
|
|
62
|
+
* | | | uuuuu | ... | 2,4 |
|
|
63
|
+
* | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
|
|
64
|
+
* | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
65
|
+
* | | | QQ | 01, 02, 03, 04 | |
|
|
66
|
+
* | | | QQQ | Q1, Q2, Q3, Q4 | |
|
|
67
|
+
* | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
|
|
68
|
+
* | | | QQQQQ | 1, 2, 3, 4 | 4 |
|
|
69
|
+
* | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
|
|
70
|
+
* | | | qo | 1st, 2nd, 3rd, 4th | 5 |
|
|
71
|
+
* | | | qq | 01, 02, 03, 04 | |
|
|
72
|
+
* | | | qqq | Q1, Q2, Q3, Q4 | |
|
|
73
|
+
* | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
|
|
74
|
+
* | | | qqqqq | 1, 2, 3, 4 | 3 |
|
|
75
|
+
* | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
|
|
76
|
+
* | | | Mo | 1st, 2nd, ..., 12th | 5 |
|
|
77
|
+
* | | | MM | 01, 02, ..., 12 | |
|
|
78
|
+
* | | | MMM | Jan, Feb, ..., Dec | |
|
|
79
|
+
* | | | MMMM | January, February, ..., December | 2 |
|
|
80
|
+
* | | | MMMMM | J, F, ..., D | |
|
|
81
|
+
* | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
|
|
82
|
+
* | | | Lo | 1st, 2nd, ..., 12th | 5 |
|
|
83
|
+
* | | | LL | 01, 02, ..., 12 | |
|
|
84
|
+
* | | | LLL | Jan, Feb, ..., Dec | |
|
|
85
|
+
* | | | LLLL | January, February, ..., December | 2 |
|
|
86
|
+
* | | | LLLLL | J, F, ..., D | |
|
|
87
|
+
* | Local week of year | 100 | w | 1, 2, ..., 53 | |
|
|
88
|
+
* | | | wo | 1st, 2nd, ..., 53th | 5 |
|
|
89
|
+
* | | | ww | 01, 02, ..., 53 | |
|
|
90
|
+
* | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
|
|
91
|
+
* | | | Io | 1st, 2nd, ..., 53th | 5 |
|
|
92
|
+
* | | | II | 01, 02, ..., 53 | 5 |
|
|
93
|
+
* | Day of month | 90 | d | 1, 2, ..., 31 | |
|
|
94
|
+
* | | | do | 1st, 2nd, ..., 31st | 5 |
|
|
95
|
+
* | | | dd | 01, 02, ..., 31 | |
|
|
96
|
+
* | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
|
|
97
|
+
* | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
|
|
98
|
+
* | | | DD | 01, 02, ..., 365, 366 | 7 |
|
|
99
|
+
* | | | DDD | 001, 002, ..., 365, 366 | |
|
|
100
|
+
* | | | DDDD | ... | 2 |
|
|
101
|
+
* | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
|
|
102
|
+
* | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
|
|
103
|
+
* | | | EEEEE | M, T, W, T, F, S, S | |
|
|
104
|
+
* | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
105
|
+
* | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
|
|
106
|
+
* | | | io | 1st, 2nd, ..., 7th | 5 |
|
|
107
|
+
* | | | ii | 01, 02, ..., 07 | 5 |
|
|
108
|
+
* | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
|
|
109
|
+
* | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
|
|
110
|
+
* | | | iiiii | M, T, W, T, F, S, S | 5 |
|
|
111
|
+
* | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
|
|
112
|
+
* | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
|
|
113
|
+
* | | | eo | 2nd, 3rd, ..., 1st | 5 |
|
|
114
|
+
* | | | ee | 02, 03, ..., 01 | |
|
|
115
|
+
* | | | eee | Mon, Tue, Wed, ..., Sun | |
|
|
116
|
+
* | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
|
|
117
|
+
* | | | eeeee | M, T, W, T, F, S, S | |
|
|
118
|
+
* | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
119
|
+
* | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
|
|
120
|
+
* | | | co | 2nd, 3rd, ..., 1st | 5 |
|
|
121
|
+
* | | | cc | 02, 03, ..., 01 | |
|
|
122
|
+
* | | | ccc | Mon, Tue, Wed, ..., Sun | |
|
|
123
|
+
* | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
|
|
124
|
+
* | | | ccccc | M, T, W, T, F, S, S | |
|
|
125
|
+
* | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
|
|
126
|
+
* | AM, PM | 80 | a..aaa | AM, PM | |
|
|
127
|
+
* | | | aaaa | a.m., p.m. | 2 |
|
|
128
|
+
* | | | aaaaa | a, p | |
|
|
129
|
+
* | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
|
|
130
|
+
* | | | bbbb | a.m., p.m., noon, midnight | 2 |
|
|
131
|
+
* | | | bbbbb | a, p, n, mi | |
|
|
132
|
+
* | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
|
|
133
|
+
* | | | BBBB | at night, in the morning, ... | 2 |
|
|
134
|
+
* | | | BBBBB | at night, in the morning, ... | |
|
|
135
|
+
* | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
|
|
136
|
+
* | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
|
|
137
|
+
* | | | hh | 01, 02, ..., 11, 12 | |
|
|
138
|
+
* | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
|
|
139
|
+
* | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
|
|
140
|
+
* | | | HH | 00, 01, 02, ..., 23 | |
|
|
141
|
+
* | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
|
|
142
|
+
* | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
|
|
143
|
+
* | | | KK | 01, 02, ..., 11, 00 | |
|
|
144
|
+
* | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
|
|
145
|
+
* | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
|
|
146
|
+
* | | | kk | 24, 01, 02, ..., 23 | |
|
|
147
|
+
* | Minute | 60 | m | 0, 1, ..., 59 | |
|
|
148
|
+
* | | | mo | 0th, 1st, ..., 59th | 5 |
|
|
149
|
+
* | | | mm | 00, 01, ..., 59 | |
|
|
150
|
+
* | Second | 50 | s | 0, 1, ..., 59 | |
|
|
151
|
+
* | | | so | 0th, 1st, ..., 59th | 5 |
|
|
152
|
+
* | | | ss | 00, 01, ..., 59 | |
|
|
153
|
+
* | Seconds timestamp | 40 | t | 512969520 | |
|
|
154
|
+
* | | | tt | ... | 2 |
|
|
155
|
+
* | Fraction of second | 30 | S | 0, 1, ..., 9 | |
|
|
156
|
+
* | | | SS | 00, 01, ..., 99 | |
|
|
157
|
+
* | | | SSS | 000, 001, ..., 999 | |
|
|
158
|
+
* | | | SSSS | ... | 2 |
|
|
159
|
+
* | Milliseconds timestamp | 20 | T | 512969520900 | |
|
|
160
|
+
* | | | TT | ... | 2 |
|
|
161
|
+
* | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
|
|
162
|
+
* | | | XX | -0800, +0530, Z | |
|
|
163
|
+
* | | | XXX | -08:00, +05:30, Z | |
|
|
164
|
+
* | | | XXXX | -0800, +0530, Z, +123456 | 2 |
|
|
165
|
+
* | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
|
|
166
|
+
* | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
|
|
167
|
+
* | | | xx | -0800, +0530, +0000 | |
|
|
168
|
+
* | | | xxx | -08:00, +05:30, +00:00 | 2 |
|
|
169
|
+
* | | | xxxx | -0800, +0530, +0000, +123456 | |
|
|
170
|
+
* | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
|
|
171
|
+
* | Long localized date | NA | P | 05/29/1453 | 5,8 |
|
|
172
|
+
* | | | PP | May 29, 1453 | |
|
|
173
|
+
* | | | PPP | May 29th, 1453 | |
|
|
174
|
+
* | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
|
|
175
|
+
* | Long localized time | NA | p | 12:00 AM | 5,8 |
|
|
176
|
+
* | | | pp | 12:00:00 AM | |
|
|
177
|
+
* | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
|
|
178
|
+
* | | | PPpp | May 29, 1453, 12:00:00 AM | |
|
|
179
|
+
* | | | PPPpp | May 29th, 1453 at ... | |
|
|
180
|
+
* | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
|
|
181
|
+
* Notes:
|
|
182
|
+
* 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
|
|
183
|
+
* are the same as "stand-alone" units, but are different in some languages.
|
|
184
|
+
* "Formatting" units are declined according to the rules of the language
|
|
185
|
+
* in the context of a date. "Stand-alone" units are always nominative singular.
|
|
186
|
+
* In `format` function, they will produce different result:
|
|
187
|
+
*
|
|
188
|
+
* `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
|
|
189
|
+
*
|
|
190
|
+
* `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
|
|
191
|
+
*
|
|
192
|
+
* `parse` will try to match both formatting and stand-alone units interchangably.
|
|
193
|
+
*
|
|
194
|
+
* 2. Any sequence of the identical letters is a pattern, unless it is escaped by
|
|
195
|
+
* the single quote characters (see below).
|
|
196
|
+
* If the sequence is longer than listed in table:
|
|
197
|
+
* - for numerical units (`yyyyyyyy`) `parse` will try to match a number
|
|
198
|
+
* as wide as the sequence
|
|
199
|
+
* - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
|
|
200
|
+
* These variations are marked with "2" in the last column of the table.
|
|
201
|
+
*
|
|
202
|
+
* 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
|
|
203
|
+
* These tokens represent the shortest form of the quarter.
|
|
204
|
+
*
|
|
205
|
+
* 4. The main difference between `y` and `u` patterns are B.C. years:
|
|
206
|
+
*
|
|
207
|
+
* | Year | `y` | `u` |
|
|
208
|
+
* |------|-----|-----|
|
|
209
|
+
* | AC 1 | 1 | 1 |
|
|
210
|
+
* | BC 1 | 1 | 0 |
|
|
211
|
+
* | BC 2 | 2 | -1 |
|
|
212
|
+
*
|
|
213
|
+
* Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
|
|
214
|
+
*
|
|
215
|
+
* `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
|
|
216
|
+
*
|
|
217
|
+
* `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
|
|
218
|
+
*
|
|
219
|
+
* while `uu` will just assign the year as is:
|
|
220
|
+
*
|
|
221
|
+
* `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
|
|
222
|
+
*
|
|
223
|
+
* `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
|
|
224
|
+
*
|
|
225
|
+
* The same difference is true for local and ISO week-numbering years (`Y` and `R`),
|
|
226
|
+
* except local week-numbering years are dependent on `options.weekStartsOn`
|
|
227
|
+
* and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}
|
|
228
|
+
* and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).
|
|
229
|
+
*
|
|
230
|
+
* 5. These patterns are not in the Unicode Technical Standard #35:
|
|
231
|
+
* - `i`: ISO day of week
|
|
232
|
+
* - `I`: ISO week of year
|
|
233
|
+
* - `R`: ISO week-numbering year
|
|
234
|
+
* - `o`: ordinal number modifier
|
|
235
|
+
* - `P`: long localized date
|
|
236
|
+
* - `p`: long localized time
|
|
237
|
+
*
|
|
238
|
+
* 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
|
|
239
|
+
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
240
|
+
*
|
|
241
|
+
* 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.
|
|
242
|
+
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
243
|
+
*
|
|
244
|
+
* 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
|
|
245
|
+
* on the given locale.
|
|
246
|
+
*
|
|
247
|
+
* using `en-US` locale: `P` => `MM/dd/yyyy`
|
|
248
|
+
* using `en-US` locale: `p` => `hh:mm a`
|
|
249
|
+
* using `pt-BR` locale: `P` => `dd/MM/yyyy`
|
|
250
|
+
* using `pt-BR` locale: `p` => `HH:mm`
|
|
251
|
+
*
|
|
252
|
+
* Values will be assigned to the date in the descending order of its unit's priority.
|
|
253
|
+
* Units of an equal priority overwrite each other in the order of appearance.
|
|
254
|
+
*
|
|
255
|
+
* If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
|
|
256
|
+
* the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
|
|
257
|
+
*
|
|
258
|
+
* `referenceDate` must be passed for correct work of the function.
|
|
259
|
+
* If you're not sure which `referenceDate` to supply, create a new instance of Date:
|
|
260
|
+
* `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
|
|
261
|
+
* In this case parsing will be done in the context of the current date.
|
|
262
|
+
* If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
|
|
263
|
+
* then `Invalid Date` will be returned.
|
|
264
|
+
*
|
|
265
|
+
* The result may vary by locale.
|
|
266
|
+
*
|
|
267
|
+
* If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
|
|
268
|
+
*
|
|
269
|
+
* If parsing failed, `Invalid Date` will be returned.
|
|
270
|
+
* Invalid Date is a Date, whose time value is NaN.
|
|
271
|
+
* Time value of Date: http://es5.github.io/#x15.9.1.1
|
|
272
|
+
*
|
|
273
|
+
* @param dateString - the string to parse
|
|
274
|
+
* @param formatString - the string of tokens
|
|
275
|
+
* @param referenceDate - defines values missing from the parsed dateString
|
|
276
|
+
* @param options - an object with options.
|
|
277
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
278
|
+
* see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
279
|
+
* @returns the parsed date
|
|
280
|
+
* @throws {RangeError} `options.locale` must contain `match` property
|
|
281
|
+
* @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
282
|
+
* @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
283
|
+
* @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
284
|
+
* @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
|
|
285
|
+
* @throws {RangeError} format string contains an unescaped latin alphabet character
|
|
286
|
+
*
|
|
287
|
+
* @example
|
|
288
|
+
* // Parse 11 February 2014 from middle-endian format:
|
|
289
|
+
* var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
|
|
290
|
+
* //=> Tue Feb 11 2014 00:00:00
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* // Parse 28th of February in Esperanto locale in the context of 2010 year:
|
|
294
|
+
* import eo from 'date-fns/locale/eo'
|
|
295
|
+
* var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
|
|
296
|
+
* locale: eo
|
|
297
|
+
* })
|
|
298
|
+
* //=> Sun Feb 28 2010 00:00:00
|
|
299
|
+
*/
|
|
300
|
+
export default function parse<DateType extends Date>(dateString: string, formatString: string, dirtyReferenceDate: DateType | number, options?: ParseOptions): DateType;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The {@link parseISO} function options.
|
|
3
|
+
*/
|
|
4
|
+
export interface ParseISOOptions {
|
|
5
|
+
additionalDigits?: 0 | 1 | 2;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @name parseISO
|
|
9
|
+
* @category Common Helpers
|
|
10
|
+
* @summary Parse ISO string
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Parse the given string in ISO 8601 format and return an instance of Date.
|
|
14
|
+
*
|
|
15
|
+
* Function accepts complete ISO 8601 formats as well as partial implementations.
|
|
16
|
+
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
|
|
17
|
+
*
|
|
18
|
+
* If the argument isn't a string, the function cannot parse the string or
|
|
19
|
+
* the values are invalid, it returns Invalid Date.
|
|
20
|
+
*
|
|
21
|
+
* @param argument - the value to convert
|
|
22
|
+
* @param options - an object with options.
|
|
23
|
+
* @returns the parsed date in the local time zone
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Convert string '2014-02-11T11:30:30' to date:
|
|
27
|
+
* const result = parseISO('2014-02-11T11:30:30')
|
|
28
|
+
* //=> Tue Feb 11 2014 11:30:30
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Convert string '+02014101' to date,
|
|
32
|
+
* // if the additional number of digits in the extended year format is 1:
|
|
33
|
+
* const result = parseISO('+02014101', { additionalDigits: 1 })
|
|
34
|
+
* //=> Fri Apr 11 2014 00:00:00
|
|
35
|
+
*/
|
|
36
|
+
export default function parseISO(argument: string, options?: ParseISOOptions): Date;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name parseJSON
|
|
3
|
+
* @category Common Helpers
|
|
4
|
+
* @summary Parse a JSON date string
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Converts a complete ISO date string in UTC time, the typical format for transmitting
|
|
8
|
+
* a date in JSON, to a JavaScript `Date` instance.
|
|
9
|
+
*
|
|
10
|
+
* This is a minimal implementation for converting dates retrieved from a JSON API to
|
|
11
|
+
* a `Date` instance which can be used with other functions in the `date-fns` library.
|
|
12
|
+
* The following formats are supported:
|
|
13
|
+
*
|
|
14
|
+
* - `2000-03-15T05:20:10.123Z`: The output of `.toISOString()` and `JSON.stringify(new Date())`
|
|
15
|
+
* - `2000-03-15T05:20:10Z`: Without milliseconds
|
|
16
|
+
* - `2000-03-15T05:20:10+00:00`: With a zero offset, the default JSON encoded format in some other languages
|
|
17
|
+
* - `2000-03-15T05:20:10+05:45`: With a positive or negative offset, the default JSON encoded format in some other languages
|
|
18
|
+
* - `2000-03-15T05:20:10+0000`: With a zero offset without a colon
|
|
19
|
+
* - `2000-03-15T05:20:10`: Without a trailing 'Z' symbol
|
|
20
|
+
* - `2000-03-15T05:20:10.1234567`: Up to 7 digits in milliseconds field. Only first 3 are taken into account since JS does not allow fractional milliseconds
|
|
21
|
+
* - `2000-03-15 05:20:10`: With a space instead of a 'T' separator for APIs returning a SQL date without reformatting
|
|
22
|
+
*
|
|
23
|
+
* For convenience and ease of use these other input types are also supported
|
|
24
|
+
* via [toDate]{@link https://date-fns.org/docs/toDate}:
|
|
25
|
+
*
|
|
26
|
+
* - A `Date` instance will be cloned
|
|
27
|
+
* - A `number` will be treated as a timestamp
|
|
28
|
+
*
|
|
29
|
+
* Any other input type or invalid date strings will return an `Invalid Date`.
|
|
30
|
+
*
|
|
31
|
+
* @param argument A fully formed ISO8601 date string to convert
|
|
32
|
+
* @returns the parsed date in the local time zone
|
|
33
|
+
*/
|
|
34
|
+
export default function parseJSON(dateString: string): Date;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Day } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @name previousDay
|
|
4
|
+
* @category Weekday Helpers
|
|
5
|
+
* @summary When is the previous day of the week?
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* When is the previous day of the week? 0-6 the day of the week, 0 represents Sunday.
|
|
9
|
+
*
|
|
10
|
+
* @param date - the date to check
|
|
11
|
+
* @param day - day of the week
|
|
12
|
+
* @returns - the date is the previous day of week
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // When is the previous Monday before Mar, 20, 2020?
|
|
16
|
+
* const result = previousDay(new Date(2020, 2, 20), 1)
|
|
17
|
+
* //=> Mon Mar 16 2020 00:00:00
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // When is the previous Tuesday before Mar, 21, 2020?
|
|
21
|
+
* const result = previousDay(new Date(2020, 2, 21), 2)
|
|
22
|
+
* //=> Tue Mar 17 2020 00:00:00
|
|
23
|
+
*/
|
|
24
|
+
export default function previousDay<DateType extends Date>(date: DateType | number, day: Day): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousFriday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Friday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Friday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Friday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Friday before Jun, 19, 2021?
|
|
14
|
+
* const result = previousFriday(new Date(2021, 5, 19))
|
|
15
|
+
* //=> Fri June 18 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousFriday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousMonday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Monday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Monday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Monday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Monday before Jun, 18, 2021?
|
|
14
|
+
* const result = previousMonday(new Date(2021, 5, 18))
|
|
15
|
+
* //=> Mon June 14 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousMonday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousSaturday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Saturday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Saturday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Saturday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Saturday before Jun, 20, 2021?
|
|
14
|
+
* const result = previousSaturday(new Date(2021, 5, 20))
|
|
15
|
+
* //=> Sat June 19 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousSaturday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousSunday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Sunday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Sunday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Sunday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Sunday before Jun, 21, 2021?
|
|
14
|
+
* const result = previousSunday(new Date(2021, 5, 21))
|
|
15
|
+
* //=> Sun June 20 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousSunday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousThursday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Thursday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Thursday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Thursday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Thursday before Jun, 18, 2021?
|
|
14
|
+
* const result = previousThursday(new Date(2021, 5, 18))
|
|
15
|
+
* //=> Thu June 17 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousThursday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousTuesday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Tuesday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Tuesday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Tuesday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Tuesday before Jun, 18, 2021?
|
|
14
|
+
* const result = previousTuesday(new Date(2021, 5, 18))
|
|
15
|
+
* //=> Tue June 15 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousTuesday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name previousWednesday
|
|
3
|
+
* @category Weekday Helpers
|
|
4
|
+
* @summary When is the previous Wednesday?
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* When is the previous Wednesday?
|
|
8
|
+
*
|
|
9
|
+
* @param date - the date to start counting from
|
|
10
|
+
* @returns the previous Wednesday
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // When is the previous Wednesday before Jun, 18, 2021?
|
|
14
|
+
* const result = previousWednesday(new Date(2021, 5, 18))
|
|
15
|
+
* //=> Wed June 16 2021 00:00:00
|
|
16
|
+
*/
|
|
17
|
+
export default function previousWednesday<DateType extends Date>(date: DateType | number): DateType;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name quartersToMonths
|
|
3
|
+
* @category Conversion Helpers
|
|
4
|
+
* @summary Convert number of quarters to months.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Convert a number of quarters to a full number of months.
|
|
8
|
+
*
|
|
9
|
+
* @param quarters - number of quarters to be converted
|
|
10
|
+
*
|
|
11
|
+
* @returns the number of quarters converted in months
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Convert 2 quarters to months
|
|
15
|
+
* const result = quartersToMonths(2)
|
|
16
|
+
* //=> 6
|
|
17
|
+
*/
|
|
18
|
+
export default function quartersToMonths(quarters: number): number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name quartersToYears
|
|
3
|
+
* @category Conversion Helpers
|
|
4
|
+
* @summary Convert number of quarters to years.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Convert a number of quarters to a full number of years.
|
|
8
|
+
*
|
|
9
|
+
* @param quarters - number of quarters to be converted
|
|
10
|
+
*
|
|
11
|
+
* @returns the number of quarters converted in years
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Convert 8 quarters to years
|
|
15
|
+
* const result = quartersToYears(8)
|
|
16
|
+
* //=> 2
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // It uses floor rounding:
|
|
20
|
+
* const result = quartersToYears(11)
|
|
21
|
+
* //=> 2
|
|
22
|
+
*/
|
|
23
|
+
export default function quartersToYears(quarters: number): number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { RoundingOptions } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The {@link roundToNearestMinutes} function options.
|
|
4
|
+
*/
|
|
5
|
+
export interface RoundToNearestMinutesOptions extends RoundingOptions {
|
|
6
|
+
nearestTo?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @name roundToNearestMinutes
|
|
10
|
+
* @category Minute Helpers
|
|
11
|
+
* @summary Rounds the given date to the nearest minute
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* Rounds the given date to the nearest minute (or number of minutes).
|
|
15
|
+
* Rounds up when the given date is exactly between the nearest round minutes.
|
|
16
|
+
*
|
|
17
|
+
* @param date - the date to round
|
|
18
|
+
* @param options - an object with options.
|
|
19
|
+
* @returns the new date rounded to the closest minute
|
|
20
|
+
* @throws {RangeError} `options.nearestTo` must be between 1 and 30
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Round 10 July 2014 12:12:34 to nearest minute:
|
|
24
|
+
* const result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34))
|
|
25
|
+
* //=> Thu Jul 10 2014 12:13:00
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* // Round 10 July 2014 12:07:30 to nearest quarter hour:
|
|
29
|
+
* const result = roundToNearestMinutes(new Date(2014, 6, 10, 12, 12, 34), { nearestTo: 15 })
|
|
30
|
+
* // rounds up because given date is exactly between 12:00:00 and 12:15:00
|
|
31
|
+
* //=> Thu Jul 10 2014 12:15:00
|
|
32
|
+
*/
|
|
33
|
+
export default function roundToNearestMinutes<DateType extends Date>(dirtyDate: DateType | number, options?: RoundToNearestMinutesOptions): DateType;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name secondsToHours
|
|
3
|
+
* @category Conversion Helpers
|
|
4
|
+
* @summary Convert seconds to hours.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Convert a number of seconds to a full number of hours.
|
|
8
|
+
*
|
|
9
|
+
* @param seconds - number of seconds to be converted
|
|
10
|
+
*
|
|
11
|
+
* @returns the number of seconds converted in hours
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Convert 7200 seconds into hours
|
|
15
|
+
* const result = secondsToHours(7200)
|
|
16
|
+
* //=> 2
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // It uses floor rounding:
|
|
20
|
+
* const result = secondsToHours(7199)
|
|
21
|
+
* //=> 1
|
|
22
|
+
*/
|
|
23
|
+
export default function secondsToHours(seconds: number): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name secondsToMilliseconds
|
|
3
|
+
* @category Conversion Helpers
|
|
4
|
+
* @summary Convert seconds to milliseconds.
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
* Convert a number of seconds to a full number of milliseconds.
|
|
8
|
+
*
|
|
9
|
+
* @param seconds - number of seconds to be converted
|
|
10
|
+
*
|
|
11
|
+
* @returns the number of seconds converted in milliseconds
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Convert 2 seconds into milliseconds
|
|
15
|
+
* const result = secondsToMilliseconds(2)
|
|
16
|
+
* //=> 2000
|
|
17
|
+
*/
|
|
18
|
+
export default function secondsToMilliseconds(seconds: number): number;
|