Package Exports
- date-fns
- date-fns/add_days
- date-fns/add_days/index
- date-fns/add_hours
- date-fns/add_hours/index
- date-fns/add_iso_years
- date-fns/add_milliseconds
- date-fns/add_minutes
- date-fns/add_minutes/index
- date-fns/add_months
- date-fns/add_months/index
- date-fns/add_quarters
- date-fns/add_seconds
- date-fns/add_seconds/index
- date-fns/add_weeks
- date-fns/add_weeks/index
- date-fns/add_years
- date-fns/closest_to
- date-fns/compare_asc
- date-fns/compare_desc
- date-fns/difference_in_calendar_days
- date-fns/difference_in_calendar_iso_weeks
- date-fns/difference_in_calendar_iso_years
- date-fns/difference_in_calendar_months
- date-fns/difference_in_calendar_quarters
- date-fns/difference_in_calendar_weeks
- date-fns/difference_in_calendar_years
- date-fns/difference_in_days
- date-fns/difference_in_days/index
- date-fns/difference_in_hours
- date-fns/difference_in_iso_years
- date-fns/difference_in_milliseconds
- date-fns/difference_in_minutes
- date-fns/difference_in_minutes/index
- date-fns/difference_in_months
- date-fns/difference_in_quarters
- date-fns/difference_in_seconds
- date-fns/difference_in_seconds/index
- date-fns/difference_in_weeks
- date-fns/difference_in_years
- date-fns/distance_in_words
- date-fns/distance_in_words_to_now
- date-fns/each_day
- date-fns/end_of_day
- date-fns/end_of_day/index
- date-fns/end_of_hour
- date-fns/end_of_iso_week
- date-fns/end_of_iso_year
- date-fns/end_of_minute
- date-fns/end_of_month
- date-fns/end_of_month/index
- date-fns/end_of_quarter
- date-fns/end_of_second
- date-fns/end_of_today
- date-fns/end_of_tomorrow
- date-fns/end_of_week
- date-fns/end_of_week/index
- date-fns/end_of_year
- date-fns/end_of_yesterday
- date-fns/format
- date-fns/format/index
- date-fns/format/index.js
- date-fns/get_date
- date-fns/get_date/index
- date-fns/get_day
- date-fns/get_day/index
- date-fns/get_day_of_year
- date-fns/get_days_in_month
- date-fns/get_days_in_year
- date-fns/get_hours
- date-fns/get_iso_week
- date-fns/get_iso_week/index
- date-fns/get_iso_weeks_in_year
- date-fns/get_iso_year
- date-fns/get_milliseconds
- date-fns/get_minutes
- date-fns/get_month
- date-fns/get_month/index
- date-fns/get_quarter
- date-fns/get_seconds
- date-fns/get_year
- date-fns/get_year/index
- date-fns/is_after
- date-fns/is_before
- date-fns/is_equal
- date-fns/is_first_day_of_month
- date-fns/is_friday
- date-fns/is_future
- date-fns/is_last_day_of_month
- date-fns/is_leap_year
- date-fns/is_monday
- date-fns/is_past
- date-fns/is_same_day
- date-fns/is_same_day/index
- date-fns/is_same_hour
- date-fns/is_same_iso_week
- date-fns/is_same_iso_year
- date-fns/is_same_minute
- date-fns/is_same_month
- date-fns/is_same_month/index
- date-fns/is_same_quarter
- date-fns/is_same_second
- date-fns/is_same_second/index
- date-fns/is_same_week
- date-fns/is_same_year
- date-fns/is_saturday
- date-fns/is_sunday
- date-fns/is_this_month
- date-fns/is_this_week
- date-fns/is_this_year
- date-fns/is_thursday
- date-fns/is_today
- date-fns/is_today/index
- date-fns/is_tomorrow
- date-fns/is_tuesday
- date-fns/is_valid
- date-fns/is_wednesday
- date-fns/is_weekend
- date-fns/is_within_range
- date-fns/is_yesterday
- date-fns/last_day_of_iso_week
- date-fns/last_day_of_iso_year
- date-fns/last_day_of_month
- date-fns/last_day_of_quarter
- date-fns/last_day_of_week
- date-fns/last_day_of_year
- date-fns/max
- date-fns/max/index
- date-fns/min
- date-fns/min/index
- date-fns/package.json
- date-fns/parse
- date-fns/parse/index
- date-fns/parse/index.js
- date-fns/set_date
- date-fns/set_date/index
- date-fns/set_day
- date-fns/set_day_of_year
- date-fns/set_hours
- date-fns/set_hours/index
- date-fns/set_milliseconds
- date-fns/set_minutes
- date-fns/set_minutes/index
- date-fns/set_month
- date-fns/set_month/index
- date-fns/set_seconds
- date-fns/set_year
- date-fns/set_year/index
- date-fns/start_of_day
- date-fns/start_of_day/index
- date-fns/start_of_hour
- date-fns/start_of_iso_week
- date-fns/start_of_iso_year
- date-fns/start_of_minute
- date-fns/start_of_minute/index
- date-fns/start_of_month
- date-fns/start_of_month/index
- date-fns/start_of_quarter
- date-fns/start_of_second
- date-fns/start_of_today
- date-fns/start_of_today/index
- date-fns/start_of_tomorrow
- date-fns/start_of_week
- date-fns/start_of_week/index
- date-fns/start_of_year
- date-fns/start_of_yesterday
- date-fns/sub_days
- date-fns/sub_days/index
- date-fns/sub_hours
- date-fns/sub_iso_years
- date-fns/sub_milliseconds
- date-fns/sub_minutes
- date-fns/sub_months
- date-fns/sub_months/index
- date-fns/sub_quarters
- date-fns/sub_seconds
- date-fns/sub_weeks
- date-fns/sub_weeks/index
- date-fns/sub_years
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (date-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
date-fns
Date helpers in the function-per-file style.
Installation
npm
npm install date-fns --save
Bower
bower install date-fns
Usage
var isLastDayOfMonth = require('date-fns/is_last_day_of_month')
var date = new Date(2014, 1, 28)
console.log(isLastDayOfMonth(date))
//=> true
API
Code is fully documented, check the source for the reference.
Common helpers
format
- format the date.isFuture
- is the given date in the future?isPast
- is the given date in the past?isEqual
- are the given dates equal?isBefore
- is the first date before the second one?isAfter
- is the first date after the second one?compareAsc
- compare the two dates and return -1, 0 or 1.compareDesc
- compare the two dates reverse chronologically and return -1, 0 or 1.max
- return the latest of the given dates.min
- return the earliest of the given dates.closestTo
- return a date from the array closest to the given date.parse
- parse the ISO-8601-formatted date.isValid
- is the given date valid?isValidDateValues
- is the date constructed from the given values exist?distanceInWords
- return the distance between the given dates in words.distanceInWordsToNow
- return the distance between the given date and now in words.
Range helpers
isWithinRange
- is the given date within the range?
Milliseconds helpers
getMilliseconds
- get the milliseconds.setMilliseconds
- set the milliseconds.addMilliseconds
- add the milliseconds to the given date.subMilliseconds
- subtract the milliseconds from the given date.differenceInMilliseconds
- get the number of milliseconds between the given dates.
Seconds helpers
getSeconds
- get the seconds.setSeconds
- set the seconds.startOfSecond
- return the start of a second for the given date.endOfSecond
- return the end of a second for the given date.addSeconds
- add the seconds to the given date.subSeconds
- subtract the seconds from the given date.differenceInSeconds
- get the number of seconds between the given dates.isSameSecond
- are the given dates in the same second?isThisSecond
- is the given date in the same second as the current date?
Minutes helpers
getMinutes
- get the minutes.setMinutes
- set the minutes.startOfMinute
- return the start of a minute for the given date.endOfMinute
- return the end of a minute for the given date.addMinutes
- add the minutes to the given date.subMinutes
- subtract the minutes from the given date.differenceInMinutes
- get the number of minutes between the given dates.isSameMinute
- are the given dates in the same minute?isThisMinute
- is the given date in the same minute as the current date?
Hours helpers
getHours
- get the hours.setHours
- set the hours.startOfHour
- return the start of an hour for the given date.endOfHour
- return the end of an hour for the given date.addHours
- add hours to the given date.subHours
- subtract hours from the given date.differenceInHours
- get the number of hours between the given dates.isSameHour
- are the given dates in the same hour?isThisHour
- is the given date in the same hour as the current date?
Day helpers
getDate
- get the day of the month.setDate
- set the day of the month.getDayOfYear
- get the day of the year.setDayOfYear
- set the day of the year.startOfDay
- return the start of a day for the given date.endOfDay
- return the end of a day for the given date.startOfYesterday
- return the start of yesterday.endOfYesterday
- return the end of yesterday.startOfToday
- return the start of today.endOfToday
- return the end of today.startOfTomorrow
- return the start of tomorrow.endOfTomorrow
- return the end of tomorrow.addDays
- add the specified number of days to the given date.subDays
- subtract the specified number of days from the given date.differenceInDays
- get the number of full days between the given dates.differenceInCalendarDays
- get the number of calendar days between the given dates.isSameDay
- are the given dates in the same day?isYesterday
- is the given date yesterday?isToday
- is the given date today?isTomorrow
- is the given date tomorrow?eachDay
- return the array of dates within the specified range.
Weekday helpers
getDay
- get the day of the week.setDay
- set the day of the week.isWeekend
- is the given date in a weekend?isSunday
- is the given date Sunday?isMonday
- is the given date Monday?isTuesday
- is the given date Tuesday?isWednesday
- is the given date Wednesday?isThursday
- is the given date Thursday?isFriday
- is the given date Friday?isSaturday
- is the given date Saturday?
Week helpers
startOfWeek
- return the start of a week for the given date.endOfWeek
- return the end of a week for the given date.lastDayOfWeek
- return the last day of a week for the given date.addWeeks
- add specified number of weeks to the given date.subWeeks
- subtract specified number of weeks from the given date.differenceInWeeks
- get the number of full weeks between the given dates.differenceInCalendarWeeks
- get the number of calendar weeks between the given dates.isSameWeek
- are the given dates in the same week?isThisWeek
- is the given date in the same week as the current date?
ISO week helpers
getISOWeek
- get the ISO week.setISOWeek
- set the ISO week.startOfISOWeek
- return the start of an ISO week for the given date.endOfISOWeek
- return the end of an ISO week for the given date.lastDayOfISOWeek
- return the last day of an ISO week for the given date.differenceInCalendarISOWeeks
- get the number of calendar ISO weeks between the given dates.isSameISOWeek
- are the given dates in the same ISO week?isThisISOWeek
- is the given date in the same ISO week as the current date?
Month helpers
getMonth
- get the month.setMonth
- set the month.startOfMonth
- return the start of a month for the given date.endOfMonth
- return the end of a month for the given date.lastDayOfMonth
- return the last day of a month for the given date.addMonths
- add the specified number of months to the given date.subMonths
- subtract the specified number of months from the given date.differenceInMonths
- get the number of full months between the given dates.differenceInCalendarMonths
- get the number of calendar months between the given dates.isSameMonth
- are the given dates in the same month?isThisMonth
- is the given date in the same month as the current date?isFirstDayOfMonth
- is the given date the first day of a month?isLastDayOfMonth
- is the given date the last day of a month?getDaysInMonth
- get the number of days in a month of the given date.
Quarter helpers
getQuarter
- get the year quarter.setQuarter
- set the year quarter.startOfQuarter
- return the start of a year quarter for the given date.endOfQuarter
- return the end of a year quarter for the given date.lastDayOfQuarter
- return the last day of a year quarter for the given date.addQuarters
- add the specified number of year quarters to the given date.subQuarters
- subtract the specified number of year quarters from the given date.differenceInQuarters
- get the number of full quarters between the given dates.differenceInCalendarQuarters
- get the number of calendar quarters between the given dates.isSameQuarter
- are the given dates in the same year quarter?isThisQuarter
- is the given date in the same quarter as the current date?
Year helpers
getYear
- get the year.setYear
- set the year.startOfYear
- return the start of a year for the given date.endOfYear
- return the end of a year for the given date.lastDayOfYear
- return the last day of a year for the given date.addYears
- add the specified number of years to the given date.subYears
- subtract the specified number of years from the given date.differenceInYears
- get the number of full years between the given dates.differenceInCalendarYears
- get the number of calendar years between the given dates.isSameYear
- are the given dates in the same year?isThisYear
- is the given date in the same year as the current date?isLeapYear
- is the given date in the leap year?getDaysInYear
- get the number of days in a year of the given date.
ISO week-numbering year helpers
getISOYear
- get the ISO week-numbering year.setISOYear
- set the ISO week-numbering year.startOfISOYear
- return the start of an ISO week-numbering year for the given date.endOfISOYear
- return the end of an ISO week-numbering year for the given date.lastDayOfISOYear
- return the last day of an ISO week-numbering year for the given date.addISOYears
- add the specified number of ISO week-numbering years to the given date.subISOYears
- subtract the specified number of ISO week-numbering years from the given date.differenceInISOYears
- get the number of full ISO week-numbering years between the given dates.differenceInCalendarISOYears
- get the number of calendar ISO week-numbering years between the given dates.isSameISOYear
- are the given dates in the same ISO week-numbering year?isThisISOYear
- is the given date in the same ISO week-numbering year as the current date?getISOWeeksInYear
- get the number of weeks in the ISO week-numbering year.
I18n
TODO
Tests
Kudos to SauceLabs for the provided Automate API. Thereby we run cross-browser tests on every push!