Handle Timestamps in Datepicker
See original GitHub issueMy dates are in Unix Timestamps, but unfortunately, the datepicker has a weird way to handle that (or none at all).
I can set U
(according to https://flatpickr.js.org/formatting/) but the submit data doesn’t accept U
instead it uses these https://github.com/angular-ui/bootstrap/tree/master/src/dateparser/docs#uibdateparsers-format-codes formatting strings, which is a bit confusing.
I hoped I can send and receive a timestamp, but show any human readable format in the date picker. Has anybody tried that?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
timestamp with jquery datepicker - Stack Overflow
You probably need a datetimepicker; you can use a widget plugin that extends datepicker functions by adding a time selection.
Read more >How do I convert a selected date from date picker to unix format?
Appsmith supports momentjs to handle date-time fields. You can use the moustache ... valueOf() : provides unix timestamp in milliseconds
Read more >DatePicker - Ant Design
DatePicker. To select or input a date. When To Use. By clicking the input box, you can select a date from a popup...
Read more >ion-datetime
Historically, handling datetime values within JavaScript, or even within HTML inputs, has always been a challenge. Specifically, JavaScript's Date object is ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I solved it ➡️ working example: https://codepen.io/localhorst/pen/gObXzZK
Just use the moment.js
X
for timestamp incustomOptions.dateFormat
For consistency, I added this replacement in
convertFormatToMoment(format)
I’ll send a PR for this.It might be because we are converting from the old format to the new and there is no rule for “U”. Can you check here to see if changing it makes a difference? https://github.com/formio/formio.js/blob/master/src/utils/utils.js#L664-L725