vendor/assets/javascripts/pickadate/picker.date.js in pickadate-rails-3.5.4.0 vs vendor/assets/javascripts/pickadate/picker.date.js in pickadate-rails-3.5.5.0
- old
+ new
@@ -1,8 +1,8 @@
/*!
- * Date picker for pickadate.js v3.5.4
+ * Date picker for pickadate.js v3.5.3
* http://amsul.github.io/pickadate.js/date.htm
*/
(function ( factory ) {
@@ -100,14 +100,14 @@
38: -7, // Up
39: function() { return isRTL() ? -1 : 1 }, // Right
37: function() { return isRTL() ? 1 : -1 }, // Left
go: function( timeChange ) {
var highlightedObject = calendar.item.highlight,
- targetDate = new Date( Date.UTC(highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange) )
+ targetDate = new Date( highlightedObject.year, highlightedObject.month, highlightedObject.date + timeChange )
calendar.set(
'highlight',
- targetDate,
+ [ targetDate.getFullYear(), targetDate.getMonth(), targetDate.getDate() ],
{ interval: timeChange }
)
this.render()
}
}
@@ -220,35 +220,30 @@
}
// If it’s an array, convert it into a date and make sure
// that it’s a valid date – otherwise default to today.
else if ( $.isArray( value ) ) {
- value = new Date(Date.UTC(value[ 0 ], value[ 1 ], value[ 2 ] ))
+ value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
value = _.isDate( value ) ? value : calendar.create().obj
}
- // If it’s a number, make a normalized date.
- else if ( _.isInteger( value ) ) {
+ // If it’s a number or date object, make a normalized date.
+ else if ( _.isInteger( value ) || _.isDate( value ) ) {
value = calendar.normalize( new Date( value ), options )
}
- // If it’s a date object, make a normalized date.
- else if ( _.isDate( value ) ) {
- value = calendar.normalize( value, options )
- }
-
// If it’s a literal true or any other case, set it to now.
else /*if ( value === true )*/ {
value = calendar.now( type, value, options )
}
// Return the compiled object.
return {
- year: isInfiniteValue || value.getUTCFullYear(),
- month: isInfiniteValue || value.getUTCMonth(),
- date: isInfiniteValue || value.getUTCDate(),
- day: isInfiniteValue || value.getUTCDay(),
+ year: isInfiniteValue || value.getFullYear(),
+ month: isInfiniteValue || value.getMonth(),
+ date: isInfiniteValue || value.getDate(),
+ day: isInfiniteValue || value.getDay(),
obj: isInfiniteValue || value,
pick: isInfiniteValue || value.getTime()
}
} //DatePicker.prototype.create
@@ -319,11 +314,11 @@
* Get the date today.
*/
DatePicker.prototype.now = function( type, value, options ) {
value = new Date()
if ( options && options.rel ) {
- value.setUTCDate( value.getUTCDate() + options.rel )
+ value.setDate( value.getDate() + options.rel )
}
return this.normalize( value, options )
}
@@ -361,17 +356,17 @@
targetYear = viewsetObject.year
targetMonth = viewsetObject.month
}
// Figure out the expected target year and month.
- targetDateObject = new Date( Date.UTC( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 ) )
- targetYear = targetDateObject.getUTCFullYear()
- targetMonth = targetDateObject.getUTCMonth()
+ targetDateObject = new Date( targetYear, targetMonth + ( options && options.nav ? options.nav : 0 ), 1 )
+ targetYear = targetDateObject.getFullYear()
+ targetMonth = targetDateObject.getMonth()
// If the month we’re going to doesn’t have enough days,
// keep decreasing the date until we reach the month’s last date.
- while ( /*safety &&*/ new Date( Date.UTC( targetYear, targetMonth, targetDate ) ).getUTCMonth() !== targetMonth ) {
+ while ( /*safety &&*/ new Date( targetYear, targetMonth, targetDate ).getMonth() !== targetMonth ) {
targetDate -= 1
/*safety -= 1
if ( !safety ) {
throw 'Fell into an infinite loop while navigating to ' + new Date( targetYear, targetMonth, targetDate ) + '.'
}*/
@@ -386,11 +381,11 @@
/**
* Normalize a date by setting the hours to midnight.
*/
DatePicker.prototype.normalize = function( value/*, options*/ ) {
- value.setUTCHours( 0, 0, 0, 0 )
+ value.setHours( 0, 0, 0, 0 )
return value
}
/**
@@ -931,10 +926,10 @@
else if ( $.isArray( unitToEnable ) ) {
matchFound = unitToEnable
if ( !matchFound[3] ) matchFound.push( 'inverted' )
}
else if ( _.isDate( unitToEnable ) ) {
- matchFound = [ unitToEnable.getUTCFullYear(), unitToEnable.getUTCMonth(), unitToEnable.getUTCDate(), 'inverted' ]
+ matchFound = [ unitToEnable.getFullYear(), unitToEnable.getMonth(), unitToEnable.getDate(), 'inverted' ]
}
break
}
}