MonthPicker
The MonthPicker is a FieldFrame field type that allows you to select a month and year, and fills in the rest (day and time) automatically. It is based on ycTIN’s monthpicker jQuery class, and therefore requires jQuery for the CP.
Features include:
- Stored in the DB as a unix timestamp (handy for search)
- The automatically appended day & time can be configured (default is “YY-MM-01 12:01 AM”)
- Each custom field can be configured to be copied to the entry date, expiration date, both, or neither (default is neither)
- If copying values to the entry and/or expiration dates, the Date tab does not have to be displayed for this to work.
- Can have multiple monthpicker fields on same page
- Compatible with FF Matrix
Configuration:
- Select “MonthPicker” from the dropdown of available field types.
- Select if you’d like the monthpicker to copy it’s values to the entry date, expiration date, both or neither
- Set the default day and time to be used when completing the date, for storage in db
Template Usage:
The template tag can accept a parameter “format”, and it uses PHP’s date() function to process. Example:
{monthpicker_custom_field format="M Y"}
The above might ouput “Dec 2009”. This the default format if none is passed.
Quirk:
To keep visual balance (see screenshots), there are always 12 years available to choose from. These are shown based on the following criteria: starting at the current year or the selected year, it shows the previous 8 years, plus the 3 subsequent. Example: if the current or selected year is 2009, the interface displays 2001 – 2012.
This approach of choosing which years to show is straight out of the ycTIN jQuery monthpicker class. It’s less than perfect, but will do for now.
Thanks:
This is the first extension I’m putting out into the ether. I hope some find it useful. Any problems or suggestions, you know what to do.
Hugs to the EE community!
- Version 1.1.2 (download), released December 14, 2009
-
- initial release