overleaf/services/web/frontend/js/features/utils/format-date.js
ilkin-overleaf 8e0aa685ce Merge pull request #12549 from overleaf/ii-history-react-list-of-all-versions
[web] All versions of history entries

GitOrigin-RevId: 7365ac4913c115b3b2872a3713d893463719c15e
2023-04-12 08:03:47 +00:00

20 lines
421 B
JavaScript

import moment from 'moment'
moment.updateLocale('en', {
calendar: {
lastDay: '[Yesterday]',
sameDay: '[Today]',
nextDay: '[Tomorrow]',
lastWeek: 'ddd, Do MMM YY',
nextWeek: 'ddd, Do MMM YY',
sameElse: 'ddd, Do MMM YY',
},
})
export function formatTime(date, format = 'h:mm a') {
return moment(date).format(format)
}
export function relativeDate(date) {
return moment(date).calendar()
}