0

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.

arnoldbird
  • 886
  • 1
  • 13
  • 30

1 Answers1

2

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)
arnoldbird
  • 886
  • 1
  • 13
  • 30