mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 12:14:05 -05:00
5480e1b371
[web] Fix disappeared pseudo labels GitOrigin-RevId: 4d33eb8888cadbccba29ac001e205db8fa717c49
29 lines
606 B
JavaScript
29 lines
606 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()
|
|
}
|
|
|
|
/**
|
|
* @param {string} isoTimestamp
|
|
* @returns {number}
|
|
*/
|
|
export function isoToUnix(isoTimestamp) {
|
|
const unixTimestamp = Date.parse(isoTimestamp) / 1000
|
|
return unixTimestamp
|
|
}
|