Skip to content

date-fns/date-fns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 - TODO
  • parse - TODO
  • isFuture - is passed date is future?

Range helpers

Day helpers

  • isWeekend - is passed date is weekend?
  • isToday - is passed date is 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 - substract specified number of days from passed date
  • eachDay - returns array of dates within specified range

Week helpers

  • startOfWeek - returns start of a week for passed date
  • endOfWeek - returns end of a week for passed date
  • isSameWeek - returns true if passed dates belongs to the same week

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 - substract 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

Year helpers

I18n

TODO