I'm using angular's getLocaleDateTimeFormat function to display selected date-time in the input field.
getLocaleDateTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short) function shows {1}, {0}
but when i use
getLocaleDateFormat(this.injector.get(LOCALE_ID), FormatWidth.Short) and getLocaleTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short) each separately they display date and time properly.
Am i doing something wrong?
My function is:
` formattingDate(date: Date): string {
if (!date || typeof date == 'string') {
return '';
}
let localeId = this.injector.get(LOCALE_ID);
let localeDateFormat = getLocaleDateFormat(localeId, FormatWidth.Short);
let localeTimeFormat = getLocaleTimeFormat(localeId, FormatWidth.Short);
let localeDateTimeFormat = getLocaleDateTimeFormat(localeId, FormatWidth.Short);
return formatDate(date, localeDateTimeFormat, localeId);
} `
the thing is getLocaleDateTimeFormat function is not getting date or time or both from date argument