1.0.0 • Published 7 years ago

date-fns-start-of v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

A collection of the date-fns startOf functions to mirror moment's startOf function.

Installation

    npm install date-fns-start-of --save

Usage

Simply add your date as the first argument, and the startOf type as your second argument and you're done!

dateFnsStartOf(Date, StartOfType one of 'second' 'minute' 'hour' 'day' 'week' 'ISOweek' month 'year' or 'ISOyear');

var dateFnsStartOf = require('date-fns-startOf');

var origDate = new Date('October 13, 2014 11:13:00');
var startMonth = dateFnsStartOf(origDate, 'month');

// startMonth = 'October 1, 2014 12:00:00'

Credits

Built using nothing but the excellent date-fns library.

1.0.0

7 years ago