diff --git a/CHANGELOG.md b/CHANGELOG.md index d952012d1..efe138fb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/index.js b/index.js index 80fff38df..a600ff758 100644 --- a/index.js +++ b/index.js @@ -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'; diff --git a/lib/Datepicker/Datepicker.js b/lib/Datepicker/Datepicker.js index 6d9ac9e13..993e3335a 100644 --- a/lib/Datepicker/Datepicker.js +++ b/lib/Datepicker/Datepicker.js @@ -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 = ''; @@ -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 diff --git a/lib/Datepicker/index.js b/lib/Datepicker/index.js index 61aa17997..9e7e36502 100644 --- a/lib/Datepicker/index.js +++ b/lib/Datepicker/index.js @@ -1,2 +1,2 @@ export { default as Calendar } from './Calendar'; -export { default } from './Datepicker'; +export { default, getLocaleDateFormat } from './Datepicker';