- Overview
- Documents
jQuery Filthypillow is a fancy and small calendar and date-time picker.
Source: aef-.github.io
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" type="text/css" href="jquery.filthypillow.css"> <script type="text/javascript" src="./libs/jquery.js"></script> <script type="text/javascript" src="./libs/moment.js"></script> <script type="text/javascript" src="jquery.filthypillow.js"></script>
2. HTML
<div class="filthypillow"></div>
3. JAVASCRIPT
var now = moment( ).subtract( "seconds", 1 ),
later = moment( ).add( "days", 7 );
$( ".filthypillow" ).filthypillow( {
minDateTime: function( ) {
return now;
},
maxDateTime: function( ) {
return later;
}
});
$( ".filthypillow" ).filthypillow( "show" );
4. HOTKEYS
enter (save)
left-right arrows/tab (switch steps)
up-down arrows (change digits)
number keys (change digits)
5. CONFIGURATION
startStep : Step that should be active on initialization.
month, day, hour, minute, meridiem
Default : day
initialDateTime : Set the initial date time to be shown.
Default : null
Example
initialDateTime: function( m ) {
return m.add( "day", 7 );
}
minDateTime : Set the earliest time that can be selected.
Default : null
Example
minDateTime: function( ) {
return moment( ).subtract( "days", 1 ); //one day ago
}
maxDateTime : Set the latest time that can be selected.
Default : null
Example
maxDateTime: function( ) {
return moment( ).add( "days", 7 ); //7 days from now
}
steps : Disable/enable steps by passing an array. Removing steps will prevent the user from activating that step (by clicking or using left/right arrows), but it will not hide the step (which should be done in CSS).
Default : [ "month", "day", "hour", "minute", "meridiem" ]
enableCalendar : Show the calendar when steps day or month are activated.
Default : true
calendar.saveOnDateSelect : Trigger save when an active date is selected within a calendar. This excludes date changes triggered from changing the month or selecting a date in a different month.
Default : false
Example
calendar: {
saveOnDateSelect: true
}
6. EVENTS
fp:save
Passes selected date object.
$( ".datetime" ).filthypillow( );
$( ".datetime" ).on( "fp:save", function( e, dateObj ) {
console.info( dateObj );
});
7. API
show( )
hide( )
destroy( )
updateDateTime( dateObj )
changeDateTimeUnit( unit, value )
setTimeZone( zone )
getDate( ): DateObj
JS Tutorial
