Skip to content

Commit e615796

Browse files
committed
Add options prop to components
1 parent 1d13cff commit e615796

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/components/DateTime.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const propTypes = {
77
PropTypes.string.isRequired,
88
PropTypes.instanceOf(Date),
99
]),
10+
// eslint-disable-next-line react/forbid-prop-types
11+
options: PropTypes.object,
1012
};
1113

12-
function DateTime({ value }) {
14+
function DateTime({ value, options }) {
1315
const intl = useIntl();
1416

15-
return useMemo(() => {
16-
return intl.dateTime(value);
17-
}, [intl.locale]);
17+
return useMemo(() => intl.dateTime(value, options), [intl.locale]);
1818
}
1919

2020
DateTime.propTypes = propTypes;

src/components/Number.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import useIntl from '../hooks/useIntl';
44

55
const propTypes = {
66
value: PropTypes.number.isRequired,
7+
// eslint-disable-next-line react/forbid-prop-types
8+
options: PropTypes.object,
79
};
810

9-
function Number({ value }) {
11+
function Number({ value, options }) {
1012
const intl = useIntl();
1113

12-
return useMemo(() => {
13-
return intl.number(value);
14-
}, [intl.locale]);
14+
return useMemo(() => intl.number(value, options), [intl.locale]);
1515
}
1616

1717
Number.propTypes = propTypes;

src/components/TimeAgo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ const propTypes = {
77
PropTypes.string.isRequired,
88
PropTypes.instanceOf(Date),
99
]),
10+
// eslint-disable-next-line react/forbid-prop-types
11+
options: PropTypes.object,
1012
};
1113

12-
function TimeAgo({ value }) {
14+
function TimeAgo({ value, options }) {
1315
const intl = useIntl();
1416

15-
return useMemo(() => {
16-
return intl.timeAgo(value);
17-
}, [intl.locale]);
17+
return useMemo(() => intl.timeAgo(value, options), [intl.locale]);
1818
}
1919

2020
TimeAgo.propTypes = propTypes;

0 commit comments

Comments
 (0)