Skip to content

Commit

Permalink
feat(datepicker): support object as locale prop
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurdenner committed Jan 17, 2022
1 parent 2c4c6b4 commit b750879
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ class SemanticDatepicker extends React.Component<
get locale() {
const { locale } = this.props;

if (typeof locale === 'object') {
return locale;
}

if (typeof require === 'undefined') {
console.warn(
"This environment doesn't support require(). Please use locale as an object."
);
}

let localeJson: Locale;

try {
Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export type SemanticDatepickerProps = PickedDayzedProps &
icon?: SemanticICONS | React.ReactElement;
inline: boolean;
inverted: boolean;
locale: LocaleOptions;
locale: LocaleOptions | Locale;
onBlur: (event: React.SyntheticEvent) => void;
onFocus: (event: React.SyntheticEvent) => void;
onChange: (
Expand Down

0 comments on commit b750879

Please sign in to comment.