Revision 75ee53cd
Added by Jonathon Turel about 5 years ago
webpack/assets/javascripts/react_app/components/common/dates/IsoDate.js | ||
---|---|---|
import React from 'react';
|
||
import PropTypes from 'prop-types';
|
||
import { FormattedDate, intlShape } from 'react-intl';
|
||
import { isoCompatibleDate } from '../../../common/helpers';
|
||
|
||
const IsoDate = (props, context) => {
|
||
const { date, defaultValue } = props;
|
||
if (date) {
|
||
const title = context.intl.formatRelative(date);
|
||
const isoDate = isoCompatibleDate(date);
|
||
const title = context.intl.formatRelative(isoDate);
|
||
|
||
return (
|
||
<span title={title}>
|
||
<FormattedDate
|
||
value={date}
|
||
value={isoDate}
|
||
day="2-digit"
|
||
month="2-digit"
|
||
year="numeric"
|
Also available in: Unified diff
Fixes #26616 - Cast dates to be ISO compatible