mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-28 20:00:10 +02:00

* Convert event-tracking to TypeScript * Convert local-storage to TypeScript * Convert mapSeries to TypeScript * Convert SessionStorage to TypeScript * Convert account-upgrade to TypeScript * Convert isValidTeXFile to TypeScript * Convert date functions to TypeScript * Convert EventEmitter to TypeScript * Convert isNetworkError to TypeScript * Convert webpack-public-path to TypeScript * Convert displayNameForUser to TypeScript GitOrigin-RevId: 79c5a2d1101fcd520f3116f0f4af29d974189d94
13 lines
329 B
TypeScript
13 lines
329 B
TypeScript
import moment from 'moment'
|
|
|
|
export function formatDate(date: moment.MomentInput, format?: string) {
|
|
if (!date) return 'N/A'
|
|
if (format == null) {
|
|
format = 'Do MMM YYYY, h:mm a'
|
|
}
|
|
return moment(date).format(format)
|
|
}
|
|
|
|
export function fromNowDate(date: moment.MomentInput | string) {
|
|
return moment(date).fromNow()
|
|
}
|