Skip to content

Commit

Permalink
STCOM-854 Expose getLocaleDateFormat Datepicker util (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaSedyx authored and zburke committed Jul 15, 2021
1 parent f29b9c2 commit 3b8ac06
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change history for stripes-components

## 9.2.1

* Expose getLocaleDateFormat Datepicker util. Refs STCOM-854.

## [9.2.0](https://github.com/folio-org/stripes-components/tree/v9.2.0) (2021-06-08)
[Full Changelog](https://github.com/folio-org/stripes-components/compare/v9.1.0...v9.2.0)

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export { default as ButtonGroup } from './lib/ButtonGroup';
export { default as Checkbox } from './lib/Checkbox';
export { default as CurrencySelect } from './lib/CurrencySelect';
export { default as CountrySelection } from './lib/CountrySelection';
export { default as Datepicker, Calendar } from './lib/Datepicker';
export { default as Datepicker, Calendar, getLocaleDateFormat } from './lib/Datepicker';
export { default as DateRangeWrapper } from './lib/DateRangeWrapper';
export { default as FormattedDate } from './lib/FormattedDate';
export { default as FormattedTime } from './lib/FormattedTime';
Expand Down
6 changes: 4 additions & 2 deletions lib/Datepicker/Datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getMomentLocalizedFormat(intl) {
}

// Returns a localized format.
export const getLocalFormat = ({ intl }) => {
export const getLocaleDateFormat = ({ intl }) => {
const tempDate = new Date('Thu May 14 2020 14:39:25 GMT-0500');
let format = '';

Expand Down Expand Up @@ -188,7 +188,9 @@ const Datepicker = (
value: valueProp,
...props }
) => {
const format = useRef(dateFormat || getLocalFormat({ intlLocale: intl.locale, localeProp: locale, intl })).current;
const format = useRef(
dateFormat || getLocaleDateFormat({ intlLocale: intl.locale, localeProp: locale, intl })
).current;
const [datePair, updateDatePair] = useState({
dateString: typeof valueProp !== 'undefined' ? parser(
valueProp, // value
Expand Down
2 changes: 1 addition & 1 deletion lib/Datepicker/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { default as Calendar } from './Calendar';
export { default } from './Datepicker';
export { default, getLocaleDateFormat } from './Datepicker';

0 comments on commit 3b8ac06

Please sign in to comment.