date-fns
Advanced tools
Comparing version 0.2.0 to 0.3.0
# Changelog | ||
## v0.3.0 (6 Oct 2014) | ||
* Additions: | ||
- `endOfDay` | ||
- `startOfMonth` | ||
- `endOfMonth` | ||
* Improvements: | ||
- `startOfDay` now sets milliseconds as well | ||
## v0.2.0 (6 Oct 2014) | ||
@@ -4,0 +13,0 @@ |
{ | ||
"name": "date-fns", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Sasha Koss <kossnocorp@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Date helpers", |
@@ -11,3 +11,6 @@ # date-fns | ||
* [`isToday`](./src/is_today.js) - is passed date is today?; | ||
* [`startOfDay`](./src/start_of_day.js) - returns start of day for passed date; | ||
* [`startOfDay`](./src/start_of_day.js) - returns start of a day for passed date; | ||
* [`endOfDay`](./src/end_of_day.js) - returns end of a day for passed date; | ||
* [`startOfMonth`](./src/start_of_month.js) - returns start of a month for passed date; | ||
* [`endOfMonth`](./src/end_of_month.js) - returns end of a month for passed date; | ||
@@ -7,3 +7,5 @@ var startOfDay = require('../start_of_day'); | ||
var result = startOfDay(date); | ||
expect(result).to.be.eql(new Date(2014, 8 /* starts from 0 */, 2)); | ||
expect(result).to.be.eql( | ||
new Date(2014, 8 /* starts from 0 */, 2, 0, 0, 0, 0) | ||
); | ||
}); | ||
@@ -14,3 +16,5 @@ | ||
var result = startOfDay(date); | ||
expect(result).to.be.eql(new Date(2014, 8 /* starts from 0 */, 2)); | ||
expect(result).to.be.eql( | ||
new Date(2014, 8 /* starts from 0 */, 2, 0, 0, 0, 0) | ||
); | ||
}); | ||
@@ -17,0 +21,0 @@ |
/** | ||
* Returns start of the day for given date. Date will be in local | ||
* timezone. | ||
* Returns start of a day for given date. Date will be in local timezone. | ||
* @param {date|string} dirtyDate | ||
@@ -9,5 +8,3 @@ * @returns {date} | ||
var date = new Date(dirtyDate); | ||
date.setHours(0); | ||
date.setMinutes(0); | ||
date.setSeconds(0); | ||
date.setHours(0, 0, 0, 0); | ||
return date; | ||
@@ -14,0 +11,0 @@ }; |
9484
20
223
16