Skip to content

Commit

Permalink
fix: access correct object property to resolve webpack import error
Browse files Browse the repository at this point in the history
Signed-off-by: Akshat Patel <[email protected]>
  • Loading branch information
Akshat55 committed Aug 24, 2023
1 parent 268fbe1 commit 229f87d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
25 changes: 11 additions & 14 deletions src/datepicker/datepicker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@ import rangePlugin from "flatpickr/dist/plugins/rangePlugin";
import flatpickr from "flatpickr";
import { NG_VALUE_ACCESSOR } from "@angular/forms";
import { carbonFlatpickrMonthSelectPlugin } from "./carbon-flatpickr-month-select";
import * as languages from "flatpickr/dist/l10n/index";
import languages from "flatpickr/dist/l10n/index";
import { DatePickerInput } from "carbon-components-angular/datepicker-input";
import { ElementService } from "carbon-components-angular/utils";
import { I18n } from "carbon-components-angular/i18n";

// Due to type error, we have to use square brackets property accessor
(languages.default["en"].weekdays.shorthand as string[])
= languages.default["en"].weekdays.longhand.map(day => {
if (day === "Thursday") {
return "Th";
}
return day.charAt(0);
});

/**
* [See demo](../../?path=/story/components-date-picker--single)
*/
Expand Down Expand Up @@ -101,8 +109,7 @@ export class DatePicker implements
OnDestroy,
OnChanges,
AfterViewChecked,
AfterViewInit,
AfterContentInit {
AfterViewInit {
private static datePickerCount = 0;

/**
Expand Down Expand Up @@ -330,16 +337,6 @@ export class DatePicker implements
}
}

ngAfterContentInit() {
(languages.default.en.weekdays.shorthand as string[])
= languages.default.en.weekdays.longhand.map(day => {
if (day === "Thursday") {
return "Th";
}
return day.charAt(0);
});
}

@HostListener("focusin")
onFocus() {
// Updates the month manually when calendar mode is range because month
Expand Down
3 changes: 2 additions & 1 deletion src/datepicker/datepicker.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default {
invalid: false,
warnText: "This is a warning",
warn: false,
disabled: false
disabled: false,
language: "en"
},
argTypes: {
theme: {
Expand Down

0 comments on commit 229f87d

Please sign in to comment.