@planet/ui
Advanced tools
Comparing version 1.1.3 to 1.1.4
@@ -27,2 +27,13 @@ 'use strict'; | ||
/* Calling new Date('yyyy-mm-dd') can result in the day being one day behind, | ||
depending on your location. This function fixes it so that the day is always | ||
consistent with the string. | ||
https://stackoverflow.com/questions/7556591/javascript-date-object-always-one-day-off | ||
*/ | ||
function normalizedDateObj(dateStr) { | ||
var newDate = dateStr ? new Date(dateStr) : new Date(); | ||
return new Date(newDate.getTime() - newDate.getTimezoneOffset() * -60000); | ||
} | ||
// There's a bug in this rule. It's unclear why it thinks there are multiple | ||
@@ -44,5 +55,5 @@ // components in this file... | ||
// Used for determining the left-most visible month | ||
currentMonth: this.props.startDate ? new Date(this.props.startDate) : new Date(), | ||
from: this.props.startDate ? new Date(this.props.startDate) : null, | ||
to: this.props.endDate ? new Date(this.props.endDate) : null, | ||
currentMonth: this.props.startDate ? normalizedDateObj(this.props.startDate) : normalizedDateObj(), | ||
from: this.props.startDate ? normalizedDateObj(this.props.startDate) : null, | ||
to: this.props.endDate ? normalizedDateObj(this.props.endDate) : null, | ||
isSelecting: false | ||
@@ -64,3 +75,3 @@ }; | ||
if (nextProps.startDate) { | ||
var startDate = new Date(nextProps.startDate); | ||
var startDate = normalizedDateObj(nextProps.startDate); | ||
nextState.from = startDate; | ||
@@ -74,3 +85,3 @@ nextState.currentMonth = startDate; | ||
if (nextProps.endDate) { | ||
var endDate = new Date(nextProps.endDate); | ||
var endDate = normalizedDateObj(nextProps.endDate); | ||
nextState.to = endDate; | ||
@@ -77,0 +88,0 @@ nextState.to = endDate; |
{ | ||
"name": "@planet/ui", | ||
"version": "1.1.3", | ||
"version": "1.1.4", | ||
"description": "Planet UI components built with React", | ||
@@ -5,0 +5,0 @@ "author": "Planet", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
154651
1099
0