In our app we have set the global format like this:
Moment.globalFormat = 'MM/DD/YYYY'
In our component we are trying to use fromNow:
<Moment fromNow>2020-06-11T22:00:00.000Z</Moment>
However this displays '06/12/2020' instead of '1 hour ago'.
Expected behaviour:
'1 hour ago'
Actual behaviour:
'06/12/2020'
Is it possible to override the global format for fromNow?
I believe global format should not be applied to fromNow as the format is determined by the locale.
I have tried the following but none of them work:
<Moment fromNow format={null}>2020-06-11T22:00:00.000Z</Moment>
<Moment fromNow format="">2020-06-11T22:00:00.000Z</Moment>
Current workaround is to remove the global format setting and it then fromNow works, however we have to set the format on every other instance of Moment.
Additional information:
In our app we have set the global format like this:
In our component we are trying to use fromNow:
However this displays '06/12/2020' instead of '1 hour ago'.
Expected behaviour:
'1 hour ago'
Actual behaviour:
'06/12/2020'
Is it possible to override the global format for fromNow?
I believe global format should not be applied to fromNow as the format is determined by the locale.
I have tried the following but none of them work:
<Moment fromNow format={null}>2020-06-11T22:00:00.000Z</Moment><Moment fromNow format="">2020-06-11T22:00:00.000Z</Moment>Current workaround is to remove the global format setting and it then fromNow works, however we have to set the format on every other instance of Moment.
Additional information: