Skip to content

Commit

Permalink
Check array is non-empty before referencing 0th element (#2854)
Browse files Browse the repository at this point in the history
  • Loading branch information
philrz authored Oct 4, 2023
1 parent 52f115e commit 9c77e24
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion apps/zui/src/js/lib/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ date.parseInZone = (string, zone, ref?) => {
} else {
if (/^\s*now.*/i.test(string)) return null
const d = chrono.casual.parse(string, ref)
if (d && d[0].text == string) {
if (d && d.length > 0 && d[0].text == string) {
return time(d[0].date()).toTs()
} else {
return null
Expand Down

0 comments on commit 9c77e24

Please sign in to comment.