-
-
Notifications
You must be signed in to change notification settings - Fork 866
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(demos): remove Intl usage from demos
- Loading branch information
Matt Lewis
committed
Dec 27, 2017
1 parent
0b94a31
commit 8d18c5b
Showing
5 changed files
with
29 additions
and
26 deletions.
There are no files selected for viewing
15 changes: 5 additions & 10 deletions
15
demos/demo-modules/customise-date-formats/custom-date-formatter.provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
import { CalendarDateFormatter, DateFormatterParams } from 'angular-calendar'; | ||
import { DatePipe } from '@angular/common'; | ||
|
||
export class CustomDateFormatter extends CalendarDateFormatter { | ||
// you can override any of the methods defined in the parent class | ||
|
||
public monthViewColumnHeader({ date, locale }: DateFormatterParams): string { | ||
return new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(date); | ||
return new DatePipe(locale).transform(date, 'EEE', locale); | ||
} | ||
|
||
public monthViewTitle({ date, locale }: DateFormatterParams): string { | ||
return new Intl.DateTimeFormat(locale, { | ||
year: 'numeric', | ||
month: 'short' | ||
}).format(date); | ||
return new DatePipe(locale).transform(date, 'MMM y', locale); | ||
} | ||
|
||
public weekViewColumnHeader({ date, locale }: DateFormatterParams): string { | ||
return new Intl.DateTimeFormat(locale, { weekday: 'short' }).format(date); | ||
return new DatePipe(locale).transform(date, 'EEE', locale); | ||
} | ||
|
||
public dayViewHour({ date, locale }: DateFormatterParams): string { | ||
return new Intl.DateTimeFormat(locale, { | ||
hour: 'numeric', | ||
minute: 'numeric' | ||
}).format(date); | ||
return new DatePipe(locale).transform(date, 'HH:mm', locale); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters