JSPM

date-fns

1.0.0-rc9
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 34172229
  • Score
    100M100P100Q232861F

Modern JavaScript date utility library

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

Build Status Docs Status

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

Milliseconds helpers

Seconds helpers

Minutes helpers

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

Weekday helpers

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

Month helpers

Quarter helpers

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!