calendar-fns
Advanced tools
Comparing version 0.1.0 to 0.2.0
# Changelog | ||
## v0.2.0 (10 Oct 2014) | ||
* Additions: | ||
- Add `isFuture` to `dayData` | ||
## v0.1.0 (7 Oct 2014) | ||
@@ -4,0 +9,0 @@ |
{ | ||
"name": "calendar-fns", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": "Sasha Koss <kossnocorp@gmail.com>", | ||
@@ -11,3 +11,3 @@ "description": "Calendar data helpers", | ||
"dependencies": { | ||
"date-fns": "^0.6.0" | ||
"date-fns": "^0.9.0" | ||
}, | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
# calendar-fns | ||
[![Build Status](https://travis-ci.org/kossnocorp/calendar-fns.svg)](https://travis-ci.org/kossnocorp/calendar-fns) | ||
Calendar helpers in function-per-file style. | ||
@@ -4,0 +6,0 @@ |
@@ -6,3 +6,3 @@ var dayData = require('../day_data'); | ||
this.clock = sinon.useFakeTimers( | ||
new Date(2014, 8 /* starts from 0 */, 25).getTime() | ||
new Date(2014, 8 /* Sep */, 25).getTime() | ||
); | ||
@@ -16,10 +16,11 @@ }); | ||
it('returns day object for given date', function() { | ||
var date = new Date('2014-09-02'); | ||
var date = new Date(2014, 8 /* Sep */, 2); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 2), | ||
date: new Date(2014, 8 /* Sep */, 2), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -29,10 +30,11 @@ }); | ||
it('trims time', function() { | ||
var date = new Date('2014-09-02T11:55:00'); | ||
var date = new Date(2014, 8 /* Sep */, 2); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 2), | ||
date: new Date(2014, 8 /* Sep */, 2), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -42,10 +44,11 @@ }); | ||
it('trims time', function() { | ||
var date = new Date('2014-09-02T11:55:00'); | ||
var date = new Date(2014, 8 /* Sep */, 2); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 2), | ||
date: new Date(2014, 8 /* Sep */, 2), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -58,7 +61,8 @@ }); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 2), | ||
date: new Date(2014, 8 /* Sep */, 2), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -68,10 +72,11 @@ }); | ||
it('calculates isToday', function() { | ||
var date = new Date(2014, 8 /* starts from 0 */, 25); | ||
var date = new Date(2014, 8 /* Sep */, 25); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 25), | ||
date: new Date(2014, 8 /* Sep */, 25), | ||
isToday: true, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -81,10 +86,11 @@ }); | ||
it('calculates isWeekend', function() { | ||
var date = new Date(2014, 8 /* starts from 0 */, 28); | ||
var date = new Date(2014, 8 /* Sep */, 21); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 28), | ||
date: new Date(2014, 8 /* Sep */, 21), | ||
isToday: false, | ||
isWeekend: true, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -94,10 +100,11 @@ }); | ||
it('calculates isFirstDayOfMonth', function() { | ||
var date = new Date(2014, 8 /* starts from 0 */, 1); | ||
var date = new Date(2014, 8 /* Sep */, 1); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 1), | ||
date: new Date(2014, 8 /* Sep */, 1), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: true, | ||
isLastDayOfMonth: false | ||
isLastDayOfMonth: false, | ||
isFuture: false | ||
}); | ||
@@ -107,10 +114,24 @@ }); | ||
it('calculates isLastDayOfMonth', function() { | ||
var date = new Date(2014, 8 /* starts from 0 */, 30); | ||
var date = new Date(2014, 7 /* Aug */, 31); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2014, 8 /* starts from 0 */, 30), | ||
date: new Date(2014, 7 /* Aug */, 31), | ||
isToday: false, | ||
isWeekend: true, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: true, | ||
isFuture: false | ||
}); | ||
}); | ||
it('calculates isFuture', function() { | ||
var date = new Date(2015, 1 /* Feb */, 11); | ||
var result = dayData(date); | ||
expect(result).to.be.eql({ | ||
date: new Date(2015, 1 /* Feb */, 11), | ||
isToday: false, | ||
isWeekend: false, | ||
isFirstDayOfMonth: false, | ||
isLastDayOfMonth: true | ||
isLastDayOfMonth: false, | ||
isFuture: true | ||
}); | ||
@@ -117,0 +138,0 @@ }); |
@@ -6,2 +6,3 @@ var startOfDay = require('date-fns/src/start_of_day'); | ||
var isLastDayOfMonth = require('date-fns/src/is_last_day_of_month'); | ||
var isFuture = require('date-fns/src/is_future'); | ||
@@ -20,3 +21,4 @@ /** | ||
isFirstDayOfMonth: isFirstDayOfMonth(date), | ||
isLastDayOfMonth: isLastDayOfMonth(date) | ||
isLastDayOfMonth: isLastDayOfMonth(date), | ||
isFuture: isFuture(date) | ||
} | ||
@@ -23,0 +25,0 @@ }; |
12345
365
15
+ Addeddate-fns@0.9.0(transitive)
- Removeddate-fns@0.6.0(transitive)
Updateddate-fns@^0.9.0