question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle Timestamps in Datepicker

See original GitHub issue

My 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.

image

I hoped I can send and receive a timestamp, but show any human readable format in the date picker. Has anybody tried that?

https://codepen.io/localhorst/pen/gObXzZK

just as reference: #2212 related #1871

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marcus-at-localhostcommented, Jan 8, 2020

I solved it ➡️ working example: https://codepen.io/localhorst/pen/gObXzZK

Just use the moment.js X for timestamp in customOptions.dateFormat

image

For consistency, I added this replacement in convertFormatToMoment(format) I’ll send a PR for this.

0reactions
randallknutsoncommented, Jan 7, 2020

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

Read more comments on GitHub >

github_iconTop 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 >
Date & Time Picker - V-Calendar
An elegant calendar and datepicker plugin for Vuejs.
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found