common: fix ts errors

This commit is contained in:
ammarahm-ed
2023-08-26 20:10:34 +05:00
committed by Abdullah Atta
parent 843be2a62c
commit 9ef40c01ce
4 changed files with 16 additions and 12 deletions

View File

@@ -64,20 +64,20 @@ export function getTimeFormat(format: TimeFormat) {
return format === "12-hour" ? "hh:mm A" : "HH:mm";
}
type TimeOptions = {
export type TimeOptions = {
type: "time";
timeFormat: TimeFormat;
};
type DateOptions = {
export type DateOptions = {
type: "date";
dateFormat: string;
};
type DateTimeOptions = {
export type DateTimeOptions = {
type: "date-time";
dateFormat: string;
timeFormat: TimeFormat;
};
type FormatDateOptions = TimeOptions | DateOptions | DateTimeOptions;
export type FormatDateOptions = TimeOptions | DateOptions | DateTimeOptions;
export function formatDate(
date: string | number | Date | null | undefined,