fix: return empty string for invalid times

This commit is contained in:
wz
2026-04-09 22:29:40 +08:00
parent cc27229414
commit ffdbf8bc44
@@ -68,7 +68,7 @@ function computeDateToUnix(input: string, useLocalTime: boolean): string {
// Unsuccesful Conversion
if (isNaN(localUnixValue)) {
return 'Invalid Date Time';
return '';
}
// Case 1: Base Scenario (Assume Time with GMT +00)
@@ -84,7 +84,7 @@ function computeDateToUnix(input: string, useLocalTime: boolean): string {
// Invalid Regex
if (!regexMatch) {
return 'Invalid Date Time';
return '';
}
// Variables to Be Processed
@@ -103,8 +103,7 @@ function computeDateToUnix(input: string, useLocalTime: boolean): string {
}
} catch (err) {
// Not Using Local Time (Either UTC is Given or Assume +00)
console.log('Error', err);
return 'Invalid Date Time';
return '';
}
}