vendor/assets/javascripts/pickadate/picker.date.js in pickadate-rails-1.2.0 vs vendor/assets/javascripts/pickadate/picker.date.js in pickadate-rails-1.2.1
- old
+ new
@@ -1,8 +1,8 @@
/*!
- * Date picker for pickadate.js v3.2.0
+ * Date picker for pickadate.js v3.2.1
* http://amsul.github.io/pickadate.js/date.htm
*/
/*jshint
debug: true,
@@ -11,15 +11,22 @@
asi: true,
unused: true,
boss: true
*/
+(function ( factory ) {
-// Create a new scope.
-(function() {
+ // Register as an anonymous module.
+ if ( typeof define === 'function' && define.amd )
+ define( ['picker'], factory )
+ // Or using browser globals.
+ else factory( Picker )
+}(function( Picker ) {
+
+
/**
* Globals and constants
*/
var DAYS_IN_WEEK = 7,
WEEKS_IN_CALENDAR = 6
@@ -179,11 +186,11 @@
value = value.obj
}
// 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 ( Array.isArray( value ) ) {
+ else if ( $.isArray( value ) ) {
value = new Date( value[ 0 ], value[ 1 ], value[ 2 ] )
value = Picker._.isDate( value ) ? value : calendar.create().obj
}
// If it’s a number or date object, make a normalized date.
@@ -311,11 +318,11 @@
// Check if the calendar is inverted and at least one weekday is enabled.
hasEnabledWeekdays = isInverted && calendar.item.disable.filter( function( value ) {
// If there’s a date, check where it is relative to the target.
- if ( Array.isArray( value ) ) {
+ if ( $.isArray( value ) ) {
var dateTime = calendar.create( value ).pick
if ( dateTime < dateObject.pick ) hasEnabledBeforeTarget = true
else if ( dateTime > dateObject.pick ) hasEnabledAfterTarget = true
}
@@ -403,11 +410,11 @@
if ( Picker._.isInteger( dateToDisable ) ) {
return dateObject.day === ( calendar.settings.firstDay ? dateToDisable : dateToDisable - 1 ) % 7
}
// If it's an array, create the object and match the exact date.
- if ( Array.isArray( dateToDisable ) ) {
+ if ( $.isArray( dateToDisable ) ) {
return dateObject.pick === calendar.create( dateToDisable ).pick
}
}).length
@@ -425,11 +432,11 @@
DatePicker.prototype.parse = function( type, value, options ) {
var calendar = this,
parsingObject = {}
- if ( !value || Picker._.isInteger( value ) || Array.isArray( value ) || Picker._.isDate( value ) || Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
+ if ( !value || Picker._.isInteger( value ) || $.isArray( value ) || Picker._.isDate( value ) || Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
return value
}
// We need a `.format` to parse the value.
if ( !( options && options.format ) ) {
@@ -623,14 +630,14 @@
/**
* Filter through the disabled collection to find a time unit.
*/
DatePicker.prototype.filterDisabled = function( collection, timeUnit, isRemoving ) {
- var timeIsArray = Array.isArray( timeUnit )
+ var timeIsArray = $.isArray( timeUnit )
return collection.filter( function( disabledTimeUnit ) {
var isMatch = !timeIsArray && timeUnit === disabledTimeUnit ||
- timeIsArray && Array.isArray( disabledTimeUnit ) && timeUnit.toString() === disabledTimeUnit.toString()
+ timeIsArray && $.isArray( disabledTimeUnit ) && timeUnit.toString() === disabledTimeUnit.toString()
return isRemoving ? !isMatch : isMatch
})
} //DatePicker.prototype.filterDisabled
@@ -948,10 +955,9 @@
* Extend the picker to add the date picker.
*/
Picker.extend( 'pickadate', DatePicker )
-// Close the scope.
-})();
+}));