File tree Expand file tree Collapse file tree 2 files changed +13
-15
lines changed
Expand file tree Collapse file tree 2 files changed +13
-15
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,19 @@ import rangePlugin from "flatpickr/dist/plugins/rangePlugin";
2121import flatpickr from "flatpickr" ;
2222import { NG_VALUE_ACCESSOR } from "@angular/forms" ;
2323import { carbonFlatpickrMonthSelectPlugin } from "./carbon-flatpickr-month-select" ;
24- import * as languages from "flatpickr/dist/l10n/index" ;
24+ import languages from "flatpickr/dist/l10n/index" ;
2525import { DatePickerInput } from "carbon-components-angular/datepicker-input" ;
26- import { ElementService } from "carbon-components-angular/utils" ;
2726import { I18n } from "carbon-components-angular/i18n" ;
2827
28+ // Due to type error, we have to use square brackets property accessor
29+ ( languages . default [ "en" ] . weekdays . shorthand as string [ ] )
30+ = languages . default [ "en" ] . weekdays . longhand . map ( day => {
31+ if ( day === "Thursday" ) {
32+ return "Th" ;
33+ }
34+ return day . charAt ( 0 ) ;
35+ } ) ;
36+
2937/**
3038 * [See demo](../../?path=/story/components-date-picker--single)
3139 */
@@ -101,8 +109,7 @@ export class DatePicker implements
101109 OnDestroy ,
102110 OnChanges ,
103111 AfterViewChecked ,
104- AfterViewInit ,
105- AfterContentInit {
112+ AfterViewInit {
106113 private static datePickerCount = 0 ;
107114
108115 /**
@@ -330,16 +337,6 @@ export class DatePicker implements
330337 }
331338 }
332339
333- ngAfterContentInit ( ) {
334- ( languages . default . en . weekdays . shorthand as string [ ] )
335- = languages . default . en . weekdays . longhand . map ( day => {
336- if ( day === "Thursday" ) {
337- return "Th" ;
338- }
339- return day . charAt ( 0 ) ;
340- } ) ;
341- }
342-
343340 @HostListener ( "focusin" )
344341 onFocus ( ) {
345342 // Updates the month manually when calendar mode is range because month
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ export default {
1717 invalid : false ,
1818 warnText : "This is a warning" ,
1919 warn : false ,
20- disabled : false
20+ disabled : false ,
21+ language : "en"
2122 } ,
2223 argTypes : {
2324 theme : {
You can’t perform that action at this time.
0 commit comments