I am using the date picker field for dates but noticed that on my JSON that gets generated is in a different format, what format is that in? Also is there a popular custom function to convert it back to the date?
Screen Shot 2020-07-29 at 2.40.19 PM|510x74
This doesn’t look like the standard datepicker that’s built into BetterForms. Which library are you using, or can you post your JSON schema used to build that field?
{
“inputType”: “date”,
“label”: “Date of Birth”,
“model”: “clientDOB”,
“placeholder”: “”,
“required”: true,
“styleClasses”: “col-md-3”,
“type”: “input”
}
I believe it is the standard FM BetterForms date.
Try looking in the snippets for the date picker. That element has a key for “format” where you can specify how to format the date as a string when placed in your JSON. Then, FileMaker will read it easily
I just added a field to capture date as well, the format is “dateTimePickerOptions”: {
“format”: “YYYY-DD-MM”,
This is from the sample page.
the value I get back is: 1596168000000 for July 31, 2020
First I thought this was the FileMaker date as number representation, it is not as July 31,2020 is 737637. Where can I find the translation for this value?
Update: the string 1596168000000 looks like the millisecond representation of the timestamp based on UTC time.
Is there a simple date picker that works as a date? I’ll check the other examples out, maybe I picked the wrong one.
This is the JSON that worked for me:
{
"dateTimePickerOptions": {
"format": "MMM D, YYYY",
"icons": {
"today": "fa fa-star"
},
"showTodayButton": true
},
"format": "MM/DD/YYYY",
"label": "Date Of Birth",
"model": "clientDOB",
"required": true,
"styleClasses": "col-md-3",
"type": "dateTimePicker"
},
For future devs:
There are two format
keys, they both use NumeralJS and format the displayed date and format the data date that is entered into the model.
I ended up using the date snippet and it gives only the date as expected.