cdro
02/17/2022, 8:01 PMawait supabase
.from<definitions['pass']>('pass')
.select(
'id, json',
{
count: 'exact',
}
)
.lt('json->expirationDate', new Date(now).toISOString().toLocaleString())
Error:
{
message: 'invalid input syntax for type json',
code: '22P02',
hint: null,
details: 'Token "-02" is invalid.'
}
silentworks
02/17/2022, 8:09 PMjson
column look like?silentworks
02/17/2022, 8:13 PMjson
expirationDate to a string you will probably need double >
instead.
js
await supabase
.from<definitions['pass']>('pass')
.select(
'id, json',
{
count: 'exact',
}
)
.lt('json->>expirationDate', new Date(now).toISOString().toLocaleString())
cdro
02/17/2022, 8:13 PM{
"generic": {
"backFields": [
{
"key": "status",
"label": "Status",
"value": "Valid"
}
],
"headerFields": [],
"auxiliaryFields": [],
"secondaryFields": []
},
"barcodes": [],
"logoText": "Logo Test",
"labelColor": "rgb(69, 74, 117)",
"formatVersion": 1,
"expirationDate": "2022-02-15T16:33:28Z",
"teamIdentifier": "G496R7LJ3Q",
"backgroundColor": "rgb(255 ,255 , 255)",
"foregroundColor": "rgb(69, 74, 117)"
}
cdro
02/17/2022, 8:14 PMsilentworks
02/17/2022, 8:15 PMcdro
02/17/2022, 8:15 PMcdro
02/17/2022, 8:16 PMcdro
02/17/2022, 8:16 PMsilentworks
02/17/2022, 8:17 PM.is
filter, but since this field is a from a jsonb
column, not sure if it will work the same. But you can give it a trycdro
02/17/2022, 8:18 PMlt
should cover that case for mecdro
02/17/2022, 8:18 PMsilentworks
02/17/2022, 8:18 PMcdro
02/17/2022, 8:20 PM.is('json->>expirationDate', null)
cdro
02/17/2022, 8:21 PMsilentworks
02/17/2022, 8:21 PMcdro
02/17/2022, 8:34 PM.or('json->>expirationDate.is.null', `json->>expirationDate.lt.${new Date(now).toISOString().toLocaleString()}`)
cdro
02/17/2022, 8:34 PMcdro
02/17/2022, 8:41 PMcdro
02/17/2022, 8:42 PM.or(`json->>expirationDate.is.null,json->>expirationDate.lt.${new Date(now).toISOString().toLocaleString()}`)
cdro
02/17/2022, 8:42 PMsilentworks
02/17/2022, 8:51 PM