JSPM

date-fns

0.15.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 35284685
  • Score
    100M100P100Q233031F

Date helpers

Package Exports

  • date-fns/package.json
  • date-fns/src/add_days
  • date-fns/src/each_day
  • date-fns/src/end_of_week
  • date-fns/src/is_before
  • date-fns/src/is_first_day_of_month
  • date-fns/src/is_future
  • date-fns/src/is_last_day_of_month
  • date-fns/src/is_same_month
  • date-fns/src/is_today
  • date-fns/src/is_weekend
  • date-fns/src/start_of_day
  • date-fns/src/start_of_month
  • date-fns/src/start_of_week
  • date-fns/src/sub_days

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

Date helpers in function-per-file style.

Installation

npm install --save date-fns

Usage

var isLastDayOfMonth = require('date-fns/src/is_last_day_of_month')
var date = new Date(2014, 1, 28)
console.log(isLastDayOfMonth(date))
//=> true

API

Code is fully documented, checkout source for reference.

Common helpers

  • format - format date.
  • isFuture - is passed date future?
  • isPast - is passed date past?
  • isEqual - are passed dates equal?
  • isBefore - is first date before second one?
  • isAfter - is first date after second one?
  • compareAsc - compares the two dates and returns -1, 0 or 1.
  • compareDesc - compares the two dates reverse chronologicaly and returns -1, 0 or 1.
  • parse - parse ISO-8601-formatted date.

Range helpers

Milliseconds helpers

Seconds helpers

Minutes helpers

Hours helpers

  • startOfHour - returns start of an hour for passed date.
  • endOfHour - returns end of an hour for passed date.
  • addHours - add hours to passed date.
  • subHours - subtracts hours from passed date.

Day helpers

  • getDayOfYear - returns day of year.
  • setDayOfYear - sets day of year.
  • isWeekend - is passed date weekend?
  • isToday - is passed date today?
  • startOfDay - returns start of a day for passed date.
  • endOfDay - returns end of a day for passed date.
  • addDays - add specified number of days to passed date.
  • subDays - subtract specified number of days from passed date.
  • eachDay - returns array of dates within specified range.
  • isSameDay - are passed dates has the same day?

Week helpers

Month helpers

  • startOfMonth - returns start of a month for passed date.
  • endOfMonth - returns end of a month for passed date.
  • addMonths - add specified number of months to passed date.
  • subMonths - subtract specified number of days from passed date.
  • isSameMonth - returns true if passed dates has same month (and year).
  • isFirstDayOfMonth - return true if passed date is first day of month.
  • isLastDayOfMonth - return true if passed date is last day of month.
  • setMonth - sets month index.
  • lastDayOfMonth - returns last day of month for passed date.

Quarter helpers

Year helpers

  • getISOYear - returns ISO week-numbering year.
  • setYear - sets full year.
  • setISOYear - sets ISO week-numbering year.
  • addYears - add specified number of years to passed date.
  • subYears - subtract specified number of years from passed date.
  • isSameYear - are passed dates has the same year?
  • startOfYear - returns start of year for passed date.
  • startOfISOYear - returns start of ISO week-numbering year for passed date.
  • endOfYear - returns end of year for passed date.
  • lastDayOfYear - returns last day of year for passed date.

I18n

TODO