This AS.form plugin is a wrap to “Pikaday” by David Bushell.
Pikaday is Copyright © 2014 David Bushell | BSD & MIT license | github.com/Pikaday/Pikaday
Developed and maintained by balestra
Licensed under Creative Commons Attribution 4.0 License for free personal/professional/commercial use, with attribution.
Includes Pikaday.
Version 1.2, released on 2020-11-06
Fields of type:
pikadaydate, an alias to pikaday if field of type date isn’t defined yet.The double class name is intentional: other plugins, loaded before or after this one, could re-define field type date.
Plugin URI: https://cdn.altersoftware.org/js-as-form/plugin/as-form-pikaday.js
Plugin name: pikaday
In alternative: asForm.addField(fieldname,'date', {options…} )
Generates a pure date picker (no time picker) field.
Common option keys can be used, in addition:
format (string): the format of the date, defaults to D.M.YYYY.placeholder (string): empty field placehoder, defaults to format.firstDay (integer): week first day, defaults to 1 (Monday, use 0 for Sunday, 2 for Tuesday, …).Date format
The format string contains:
Yfor the year (4 or four means 4-digits year). No Y parses/outputs a date in current year.M for monts, MM always uses 2-digits month.D for day, DD always uses 2-digits day.E.g:
YYYY-MM-DD is the SQL-like dateMM, DD YYYY or DD.MM.YY can be used, actually you can use wathever paying attention only to D, M and Y.YYYYMMDD and DDMMYY are also valid. Pay attention to use double M, double D, 0, 2 or 4 Y (no year => current year).Date can be input with keyboard, in this case the input string is parsed regardless of the actual delimiter.
When decoding user input or field value:
E.g.:
YYYY-MM-DD, value/input 2/8/21 becomes 2002-08-21.YYYY-MM-DD, value/input 2/8/2021 becomes 2008-02-11 (because it's year 2002, month August… but day 2021!)D/M/YYYY, value/input 2.8.21 becomes 2/8/2021.D/M/YY, value/input 02 08 2021 becomes 2/8/21.DD/MM/YYYY, value/input 2.8.21 becomes 02/08/2021.DD/MM/YYYY, value/input 02082021 becomes 02/08/2021.DD/MM/YY, value/input 02082021 becomes 02/08/20 (beware of year!).DD/MM/YYYY, value/input 020821 fails, while value/input 02082021 becomes 02/08/2021.DDMMYYYY, value/input 2 8 21 becomes 02082021.YYMMDD, value/input 2 8 21 becomes 020821 (possibly wrong?)YYYYMMDD, value/input 2 8 21 becomes 20020821 (possibly wrong?)When plugin is loaded it defines AS.form default value dateStringFormat as D.M.YYYY, if not defined yet.
This will be the default date string format.
The command AS.form.setDefault('dateStringFormat','YYYY-MM-DD') can change it into YYYY-MM-DD from that moment on.
When plugin is loaded it defines AS.form default value weekFirstDay as 1 (Monday), if not defined yet.
This will be the default week first day.
The command AS.form.setDefault('weekFirstDay',0) can change it into Sunday from that moment on.
date