fix: add null check for date parameter in time utility to prevent errors
This commit is contained in:
parent
10c2379a34
commit
e6bd6ec210
|
|
@ -61,6 +61,7 @@ export const formatTime = (date: string | Date) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const time = (date: string | Date) => {
|
export const time = (date: string | Date) => {
|
||||||
|
if (!date) return null;
|
||||||
if (date === "string") {
|
if (date === "string") {
|
||||||
const timeFormatRegex = /^(\d{2}):(\d{2})$/;
|
const timeFormatRegex = /^(\d{2}):(\d{2})$/;
|
||||||
if (timeFormatRegex.test(date)) {
|
if (timeFormatRegex.test(date)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue