In the tcomb-form library, what date format will t.Date accept?

280 views Asked by At

To set a value for a t.Date field, what format do I use?

value.my_date = '2018-07-12T14:31:40' // This doesn't work.  Neither does any other format I try.

Note: I am not asking how to format a date for display. I need to populate my form fields with the previously saved values, but do not know how to format the date value in a way that t.Date will understand.

1

There are 1 answers

0
arnoldbird On BEST ANSWER

The format doesn't matter. The value must be set to a javascript Date instance. That instance can be set using any format javascript will accept. For example:

let string = 'Thu Jun 29 2018 15:12:27 GMT-0400'
value.my_date = new Date(string)