react-daypicker
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -84,3 +84,3 @@ "use strict"; | ||
var isToday = day && day.valueOf() === today.valueOf(); | ||
var isActive = active && day && active.valueOf() === day.valueOf(); | ||
var isActive = active && day && DayPicker.isSameDay(active, day); | ||
return _react.default.createElement("td", { | ||
@@ -205,2 +205,7 @@ className: ["day", isActive ? "active" : null, !day ? "empty" : null, isToday ? "today" : null].filter(function (v) { | ||
} | ||
}], [{ | ||
key: "isSameDay", | ||
value: function isSameDay(a, b) { | ||
return a && b && a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth() && a.getDate() === b.getDate(); | ||
} | ||
}]); | ||
@@ -207,0 +212,0 @@ |
{ | ||
"name": "react-daypicker", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "A simple datepicker inspired by Pikaday.", | ||
@@ -5,0 +5,0 @@ "main": "lib/DayPicker.js", |
@@ -18,12 +18,4 @@ # react-daypicker | ||
as a consumer that the `active` prop which was a `moment` date is **now expected to be a vanilla | ||
JavaScript date**. However, for date equality reasons, `active` is expected to be a day so you | ||
must pass in a `Date` instance with no more accuracy beyond date set. | ||
JavaScript date**. | ||
Example: | ||
```javascript | ||
<DayPicker active={new Date(2018, 11, 1)} /> | ||
``` | ||
([remember with JavaScript, months start at 0 so 11 is December](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getMonth)) | ||
## Installation | ||
@@ -66,3 +58,3 @@ | ||
<DayPicker | ||
active={new Date(2018, 11, 1)} | ||
active={new Date()} | ||
onDayClick={(day) => this.setState({ day })} | ||
@@ -69,0 +61,0 @@ /> |
@@ -17,3 +17,2 @@ import React, { Component } from "react"; | ||
]; | ||
const DAYS_LONG = [ | ||
@@ -28,3 +27,2 @@ "Sunday", | ||
]; | ||
const DAYS_SHORT = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]; | ||
@@ -46,2 +44,12 @@ | ||
static isSameDay(a, b) { | ||
return ( | ||
a && | ||
b && | ||
a.getFullYear() === b.getFullYear() && | ||
a.getMonth() === b.getMonth() && | ||
a.getDate() === b.getDate() | ||
); | ||
} | ||
get days() { | ||
@@ -124,3 +132,3 @@ const { month, year } = this.state; | ||
const isToday = day && day.valueOf() === today.valueOf(); | ||
const isActive = active && day && active.valueOf() === day.valueOf(); | ||
const isActive = active && day && DayPicker.isSameDay(active, day); | ||
@@ -127,0 +135,0 @@ return ( |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
396
65562
125