Improves date header localization
Adds locale support to the date header renderer and date service. This change ensures that the day names are displayed correctly based on the user's configured locale. The date header now uses the configured locale to display the day name in the correct language. The day name is now displayed in uppercase. Additionally, styles the date header to highlight today's date.
This commit is contained in:
parent
6f79954342
commit
8ca49037e9
4 changed files with 31 additions and 22 deletions
|
|
@ -139,10 +139,11 @@ export class DateService {
|
|||
* Get day name for a date
|
||||
* @param date - Date to get day name for
|
||||
* @param format - 'short' (e.g., 'Mon') or 'long' (e.g., 'Monday')
|
||||
* @param locale - Locale for day name (default: 'da-DK')
|
||||
* @returns Day name
|
||||
*/
|
||||
public getDayName(date: Date, format: 'short' | 'long' = 'short'): string {
|
||||
const formatter = new Intl.DateTimeFormat('en-US', {
|
||||
public getDayName(date: Date, format: 'short' | 'long' = 'short', locale: string = 'da-DK'): string {
|
||||
const formatter = new Intl.DateTimeFormat(locale, {
|
||||
weekday: format
|
||||
});
|
||||
return formatter.format(date);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue