Lib: Check for empty string in format_date
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 28s
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 28s
This commit is contained in:
@ -24,5 +24,8 @@ export const timeformat: string = "HH:mm";
|
|||||||
* Format a [Date] object using a [date-fns] formatstring.
|
* Format a [Date] object using a [date-fns] formatstring.
|
||||||
* This function uses localtime instead of UTC.
|
* This function uses localtime instead of UTC.
|
||||||
*/
|
*/
|
||||||
export const format_date = <T extends Date | string>(date: T, formatstring: string): string =>
|
export const format_date = <T extends Date | string>(date: T, formatstring: string): string => {
|
||||||
format(new Date(date), formatstring);
|
if (!date) return "";
|
||||||
|
|
||||||
|
return format(new Date(date), formatstring);
|
||||||
|
};
|
||||||
|
Reference in New Issue
Block a user