pax.widget.datepick

This is a widget that allows you to pick a date, plus parse text such as ‘next friday’

Author

Mikkel Bergmann, http://www.pointful.com

Summary
pax.widget.datepickThis is a widget that allows you to pick a date, plus parse text such as ‘next friday’
Functions
pax.widget.datePick.initDisplays a button next to the specified field, that can display the calendar.
pax.widget.datePick.templateFooterReturns a PAX template for the buttons on the footer
pax.widget.datePick.templateReturns a PAX template for the calendar; this template has partial rendering for the days part

Functions

pax.widget.datePick.init

pax.widget.datePick.init = function(displayField,
args)

Displays a button next to the specified field, that can display the calendar.  Simply

Parameters

displayFieldthe field we want to attach the date picker to
argsoptional argument object to pass to the menu function, ie: {}
  • dateFormat - Select a date format, as specified in pax.date, this is the exact format that the standard PHP date libarry uses
  • selectedDate - dd-mm-yyyy formatted date to show, in case there is no date in the displayField, default is today
  • mondayFirst - boolean to choose if monday is first day of the week, default = true
  • dayNum - the day to start on
  • monthNum - the month number to start on (0 = jan, 11 = dec)
  • yearNum - the full year
  • validate - should we validate the date (using the pax validation library)
  • mondayFirst - is Monday the first day of the week, default: true

Example

<input id='pax.widget.datePick.init.example1' type='text'>
[:.
    var example1 = pax.widget.datePick.init( $('pax.widget.datePick.init.example1') );
    exampleCleanup = function() {
        pax.widget.datePick.destroy( $('pax.widget.datePick.init.example1') );
    };
:]

This example shows a simple date picker, with all the default settings

Example

<input id='pax.widget.datePick.init.example2' type='text' value='07-07-2007'>
[:.
    pax.widget.datePick.init( $('pax.widget.datePick.init.example2') );
    exampleCleanup = function() {
        pax.widget.datePick.destroy( $('pax.widget.datePick.init.example2') );
    };
:]

This example shows a simple date picker, with all the default settings, and a pre-populated field

Example

<input id='pax.widget.datePick.init.example3' type='text'>
[:.
    pax.widget.datePick.init( $('pax.widget.datePick.init.example3'), { selectedDate: '07-07-1988' } );
    exampleCleanup = function() {
        pax.widget.datePick.destroy( $('pax.widget.datePick.init.example3') );
    };
:]

This example shows a simple date picker, with a specified startDate

pax.widget.datePick.templateFooter

pax.widget.datePick.templateFooter = function()

Returns a PAX template for the buttons on the footer

pax.widget.datePick.template

pax.widget.datePick.template = function()

Returns a PAX template for the calendar; this template has partial rendering for the days part

pax.widget.datePick.init = function(displayField,
args)
Displays a button next to the specified field, that can display the calendar.
pax.widget.datePick.templateFooter = function()
Returns a PAX template for the buttons on the footer
pax.widget.datePick.template = function()
Returns a PAX template for the calendar; this template has partial rendering for the days part
This is the date parsing and manipulation library; the date formatting methods in this script are from the awesome script by Baron Schwartz, originally published here:
Close