You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
4 years ago | |
|---|---|---|
| .. | ||
| _lib | 4 years ago | |
| add | 4 years ago | |
| addBusinessDays | 4 years ago | |
| addDays | 4 years ago | |
| addHours | 4 years ago | |
| addISOWeekYears | 4 years ago | |
| addMilliseconds | 4 years ago | |
| addMinutes | 4 years ago | |
| addMonths | 4 years ago | |
| addQuarters | 4 years ago | |
| addSeconds | 4 years ago | |
| addWeeks | 4 years ago | |
| addYears | 4 years ago | |
| areIntervalsOverlapping | 4 years ago | |
| clamp | 4 years ago | |
| closestIndexTo | 4 years ago | |
| closestTo | 4 years ago | |
| compareAsc | 4 years ago | |
| compareDesc | 4 years ago | |
| constants | 4 years ago | |
| daysToWeeks | 4 years ago | |
| differenceInBusinessDays | 4 years ago | |
| differenceInCalendarDays | 4 years ago | |
| differenceInCalendarISOWeekYears | 4 years ago | |
| differenceInCalendarISOWeeks | 4 years ago | |
| differenceInCalendarMonths | 4 years ago | |
| differenceInCalendarQuarters | 4 years ago | |
| differenceInCalendarWeeks | 4 years ago | |
| differenceInCalendarYears | 4 years ago | |
| differenceInDays | 4 years ago | |
| differenceInHours | 4 years ago | |
| differenceInISOWeekYears | 4 years ago | |
| differenceInMilliseconds | 4 years ago | |
| differenceInMinutes | 4 years ago | |
| differenceInMonths | 4 years ago | |
| differenceInQuarters | 4 years ago | |
| differenceInSeconds | 4 years ago | |
| differenceInWeeks | 4 years ago | |
| differenceInYears | 4 years ago | |
| docs | 4 years ago | |
| eachDayOfInterval | 4 years ago | |
| eachHourOfInterval | 4 years ago | |
| eachMinuteOfInterval | 4 years ago | |
| eachMonthOfInterval | 4 years ago | |
| eachQuarterOfInterval | 4 years ago | |
| eachWeekOfInterval | 4 years ago | |
| eachWeekendOfInterval | 4 years ago | |
| eachWeekendOfMonth | 4 years ago | |
| eachWeekendOfYear | 4 years ago | |
| eachYearOfInterval | 4 years ago | |
| endOfDay | 4 years ago | |
| endOfDecade | 4 years ago | |
| endOfHour | 4 years ago | |
| endOfISOWeek | 4 years ago | |
| endOfISOWeekYear | 4 years ago | |
| endOfMinute | 4 years ago | |
| endOfMonth | 4 years ago | |
| endOfQuarter | 4 years ago | |
| endOfSecond | 4 years ago | |
| endOfToday | 4 years ago | |
| endOfTomorrow | 4 years ago | |
| endOfWeek | 4 years ago | |
| endOfYear | 4 years ago | |
| endOfYesterday | 4 years ago | |
| esm | 4 years ago | |
| format | 4 years ago | |
| formatDistance | 4 years ago | |
| formatDistanceStrict | 4 years ago | |
| formatDistanceToNow | 4 years ago | |
| formatDistanceToNowStrict | 4 years ago | |
| formatDuration | 4 years ago | |
| formatISO | 4 years ago | |
| formatISO9075 | 4 years ago | |
| formatISODuration | 4 years ago | |
| formatRFC3339 | 4 years ago | |
| formatRFC7231 | 4 years ago | |
| formatRelative | 4 years ago | |
| fp | 4 years ago | |
| fromUnixTime | 4 years ago | |
| getDate | 4 years ago | |
| getDay | 4 years ago | |
| getDayOfYear | 4 years ago | |
| getDaysInMonth | 4 years ago | |
| getDaysInYear | 4 years ago | |
| getDecade | 4 years ago | |
| getHours | 4 years ago | |
| getISODay | 4 years ago | |
| getISOWeek | 4 years ago | |
| getISOWeekYear | 4 years ago | |
| getISOWeeksInYear | 4 years ago | |
| getMilliseconds | 4 years ago | |
| getMinutes | 4 years ago | |
| getMonth | 4 years ago | |
| getOverlappingDaysInIntervals | 4 years ago | |
| getQuarter | 4 years ago | |
| getSeconds | 4 years ago | |
| getTime | 4 years ago | |
| getUnixTime | 4 years ago | |
| getWeek | 4 years ago | |
| getWeekOfMonth | 4 years ago | |
| getWeekYear | 4 years ago | |
| getWeeksInMonth | 4 years ago | |
| getYear | 4 years ago | |
| hoursToMilliseconds | 4 years ago | |
| hoursToMinutes | 4 years ago | |
| hoursToSeconds | 4 years ago | |
| intervalToDuration | 4 years ago | |
| intlFormat | 4 years ago | |
| isAfter | 4 years ago | |
| isBefore | 4 years ago | |
| isDate | 4 years ago | |
| isEqual | 4 years ago | |
| isExists | 4 years ago | |
| isFirstDayOfMonth | 4 years ago | |
| isFriday | 4 years ago | |
| isFuture | 4 years ago | |
| isLastDayOfMonth | 4 years ago | |
| isLeapYear | 4 years ago | |
| isMatch | 4 years ago | |
| isMonday | 4 years ago | |
| isPast | 4 years ago | |
| isSameDay | 4 years ago | |
| isSameHour | 4 years ago | |
| isSameISOWeek | 4 years ago | |
| isSameISOWeekYear | 4 years ago | |
| isSameMinute | 4 years ago | |
| isSameMonth | 4 years ago | |
| isSameQuarter | 4 years ago | |
| isSameSecond | 4 years ago | |
| isSameWeek | 4 years ago | |
| isSameYear | 4 years ago | |
| isSaturday | 4 years ago | |
| isSunday | 4 years ago | |
| isThisHour | 4 years ago | |
| isThisISOWeek | 4 years ago | |
| isThisMinute | 4 years ago | |
| isThisMonth | 4 years ago | |
| isThisQuarter | 4 years ago | |
| isThisSecond | 4 years ago | |
| isThisWeek | 4 years ago | |
| isThisYear | 4 years ago | |
| isThursday | 4 years ago | |
| isToday | 4 years ago | |
| isTomorrow | 4 years ago | |
| isTuesday | 4 years ago | |
| isValid | 4 years ago | |
| isWednesday | 4 years ago | |
| isWeekend | 4 years ago | |
| isWithinInterval | 4 years ago | |
| isYesterday | 4 years ago | |
| lastDayOfDecade | 4 years ago | |
| lastDayOfISOWeek | 4 years ago | |
| lastDayOfISOWeekYear | 4 years ago | |
| lastDayOfMonth | 4 years ago | |
| lastDayOfQuarter | 4 years ago | |
| lastDayOfWeek | 4 years ago | |
| lastDayOfYear | 4 years ago | |
| lightFormat | 4 years ago | |
| locale | 4 years ago | |
| max | 4 years ago | |
| milliseconds | 4 years ago | |
| millisecondsToHours | 4 years ago | |
| millisecondsToMinutes | 4 years ago | |
| millisecondsToSeconds | 4 years ago | |
| min | 4 years ago | |
| minutesToHours | 4 years ago | |
| minutesToMilliseconds | 4 years ago | |
| minutesToSeconds | 4 years ago | |
| monthsToQuarters | 4 years ago | |
| monthsToYears | 4 years ago | |
| nextDay | 4 years ago | |
| nextFriday | 4 years ago | |
| nextMonday | 4 years ago | |
| nextSaturday | 4 years ago | |
| nextSunday | 4 years ago | |
| nextThursday | 4 years ago | |
| nextTuesday | 4 years ago | |
| nextWednesday | 4 years ago | |
| parse | 4 years ago | |
| parseISO | 4 years ago | |
| parseJSON | 4 years ago | |
| previousDay | 4 years ago | |
| previousFriday | 4 years ago | |
| previousMonday | 4 years ago | |
| previousSaturday | 4 years ago | |
| previousSunday | 4 years ago | |
| previousThursday | 4 years ago | |
| previousTuesday | 4 years ago | |
| previousWednesday | 4 years ago | |
| quartersToMonths | 4 years ago | |
| quartersToYears | 4 years ago | |
| roundToNearestMinutes | 4 years ago | |
| secondsToHours | 4 years ago | |
| secondsToMilliseconds | 4 years ago | |
| secondsToMinutes | 4 years ago | |
| set | 4 years ago | |
| setDate | 4 years ago | |
| setDay | 4 years ago | |
| setDayOfYear | 4 years ago | |
| setHours | 4 years ago | |
| setISODay | 4 years ago | |
| setISOWeek | 4 years ago | |
| setISOWeekYear | 4 years ago | |
| setMilliseconds | 4 years ago | |
| setMinutes | 4 years ago | |
| setMonth | 4 years ago | |
| setQuarter | 4 years ago | |
| setSeconds | 4 years ago | |
| setWeek | 4 years ago | |
| setWeekYear | 4 years ago | |
| setYear | 4 years ago | |
| startOfDay | 4 years ago | |
| startOfDecade | 4 years ago | |
| startOfHour | 4 years ago | |
| startOfISOWeek | 4 years ago | |
| startOfISOWeekYear | 4 years ago | |
| startOfMinute | 4 years ago | |
| startOfMonth | 4 years ago | |
| startOfQuarter | 4 years ago | |
| startOfSecond | 4 years ago | |
| startOfToday | 4 years ago | |
| startOfTomorrow | 4 years ago | |
| startOfWeek | 4 years ago | |
| startOfWeekYear | 4 years ago | |
| startOfYear | 4 years ago | |
| startOfYesterday | 4 years ago | |
| sub | 4 years ago | |
| subBusinessDays | 4 years ago | |
| subDays | 4 years ago | |
| subHours | 4 years ago | |
| subISOWeekYears | 4 years ago | |
| subMilliseconds | 4 years ago | |
| subMinutes | 4 years ago | |
| subMonths | 4 years ago | |
| subQuarters | 4 years ago | |
| subSeconds | 4 years ago | |
| subWeeks | 4 years ago | |
| subYears | 4 years ago | |
| toDate | 4 years ago | |
| weeksToDays | 4 years ago | |
| yearsToMonths | 4 years ago | |
| yearsToQuarters | 4 years ago | |
| CHANGELOG.md | 4 years ago | |
| LICENSE.md | 4 years ago | |
| README.md | 4 years ago | |
| index.js | 4 years ago | |
| index.js.flow | 4 years ago | |
| package.json | 4 years ago | |
| types.js | 4 years ago | |
| typings.d.ts | 4 years ago | |
README.md
date-fns provides the most comprehensive, yet simple and consistent toolset
for manipulating JavaScript dates in a browser & Node.js.
It's like Lodash for dates
- It has 200+ functions for all occasions.
- Modular: Pick what you need. Works with webpack, Browserify, or Rollup and also supports tree-shaking.
- Native dates: Uses existing native type. It doesn't extend core objects for safety's sake.
- Immutable & Pure: Built using pure functions and always returns a new date instance.
- TypeScript & Flow: Supports both Flow and TypeScript
- I18n: Dozens of locales. Include only what you need.
- and many more benefits
import { compareAsc, format } from 'date-fns'
format(new Date(2014, 1, 11), 'yyyy-MM-dd')
//=> '2014-02-11'
const dates = [
new Date(1995, 6, 2),
new Date(1987, 1, 11),
new Date(1989, 6, 10),
]
dates.sort(compareAsc)
//=> [
// Wed Feb 11 1987 00:00:00,
// Mon Jul 10 1989 00:00:00,
// Sun Jul 02 1995 00:00:00
// ]
The library is available as an npm package. To install the package run:
npm install date-fns --save
# or with yarn
yarn add date-fns
Docs
See date-fns.org for more details, API, and other docs.