122
rated 0 times
[
124]
[
2]
/ answers: 1 / hits: 10898
/ 7 Years ago, sun, november 12, 2017, 12:00:00
In moment, with calendar, I can customize how to show the time like below
moment(dateTime).calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'DD/MM/YYYY'
});
In date-fns, based on the formatRelative, I can provide options
.
formatRelative(dateTime, Date.now(), options);
However, after reading options
document, I still cannot figure out how to customize it.
Any guide will be helpful. Thanks
More From » datetime