Skip to content

Commit

Permalink
fix empty strings being parsed into invalid dates by client js
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich authored Jan 2, 2024
1 parent b4ceddf commit 4a31037
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion node/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ const stripTrailingSlash = (str: string) => {
const RFC3339 = /^(?:\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01]))?(?:[T\s](?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?(?:\.\d+)?(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)?)?$/;
function reviver(key: any, value: any) {
// Convert any ISO8601/RFC3339 strings to dates
if (typeof value === "string" && RFC3339.test(value)) {
if (value && typeof value === "string" && RFC3339.test(value)) {
return new Date(value);
}
return value;
Expand Down

0 comments on commit 4a31037

Please sign in to comment.