Skip to main content

Date/time functions

toInstant

Commentary

added in 0.0.31

Generates an Instant type for use with a backend requiring non-string timestamps.


Examples

Casting timestamps

{
"_gen": "toInstant",
"ms": {
"_gen": "now"
}
}
[
"2024-04-25T20:28:47.262Z"
]

Specification

JSON schema

{
"type": "object",
"properties": {
"ms": {
"oneOf": [
{
"type": "number"
},
{
"type": "object",
"properties": {
"_gen": {
"type": "string"
}
},
"required": [
"_gen"
]
}
]
}
}
}