[utils] Add placeholder to datetime utils

This commit is contained in:
Ferdinand Thiessen 2021-11-26 11:14:15 +01:00
parent c9df257bbf
commit d516839ad4
1 changed files with 4 additions and 4 deletions

View File

@ -17,12 +17,12 @@ export function formatDateTime(
return dateTimeFormat.format(date);
}
export function asDate(date?: Date) {
return date ? formatDateTime(date, true) : '';
export function asDate(date?: Date, placeholder = '') {
return date ? formatDateTime(date, true) : placeholder;
}
export function asHour(date?: Date) {
return date ? formatDateTime(date, false, true) : '';
export function asHour(date?: Date, placeholder = '') {
return date ? formatDateTime(date, false, true) : placeholder;
}
export function formatStartEnd(start: Date, end?: Date) {