Timestamps including seconds

Hey Everyone!

I am working with the ex-bond-trading model which requires some inputs as Time. I have used type Date before and have had no problem using standard material-ui date pickers which represent dates as “2020-09-09”.

However, this particular model requires DateTime (including seconds). What format is the DAML-LF compiler expecting for this? The material ui DateTime picker returns “2020-09-09T00:00”. This didn’t work. I also tried adding seconds below.

`

> Error: JsonError: cannot interpret 2018-05-14T00:00:00 as Timestamp

`
I’m not so concerned with building a custom component that formats the DateTime correctly, as much as figuring out the correct format that DAML-LF is expecting. I can hardcode the datetime if need be for demonstration purposes.

Thanks!

2 Likes

Hi @jamesljaworski85, you can find all documentation on the JSON format at https://docs.daml.com/json-api/lf-value-specification.html#timestamp. For DAML-LF Timestamps, you need an ISO 8601 string of a UTC time. In your example, that would be 2020-09-09T00:00Z.

2 Likes

Thanks for pointing me in the correct direction, @cocreature! I had not seen that part of the documentation yet.

2 Likes