fix: handle nullable expiry values from a db
This commit is contained in:
parent
dd479d4117
commit
d165264876
3 changed files with 8 additions and 2 deletions
|
|
@ -56,6 +56,7 @@ export default function Page() {
|
|||
|
||||
const expired = machine.expiry === '0001-01-01 00:00:00'
|
||||
|| machine.expiry === '0001-01-01T00:00:00Z'
|
||||
|| machine.expiry === null
|
||||
? false
|
||||
: new Date(machine.expiry).getTime() < Date.now()
|
||||
|
||||
|
|
@ -134,7 +135,10 @@ export default function Page() {
|
|||
/>
|
||||
<Attribute
|
||||
name="Expiry"
|
||||
value={new Date(machine.expiry).toLocaleString()}
|
||||
value={expired
|
||||
? new Date(machine.expiry).toLocaleString()
|
||||
: 'Never'
|
||||
}
|
||||
/>
|
||||
{magic
|
||||
? (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue