mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Fixed test
This commit is contained in:
parent
1437dd5f27
commit
8eda8d3c84
@ -91,7 +91,14 @@ export function timerPop() {
|
||||
|
||||
export const formatMsToRelative = (ms: number) => {
|
||||
if (Date.now() - ms > 2 * Day) return formatMsToLocal(ms);
|
||||
return dayjs(ms).fromNow(false);
|
||||
const d = dayjs(ms);
|
||||
|
||||
// The expected pattern for invalid date formatting in JS is to return the string "Invalid
|
||||
// Date", so we do that here. If we don't, dayjs will process the invalid date and return "a
|
||||
// month ago", somehow...
|
||||
if (!d.isValid()) return 'Invalid Date';
|
||||
|
||||
return d.fromNow(false);
|
||||
};
|
||||
|
||||
const joplinLocaleToDayJsLocale = (locale: string) => {
|
||||
|
Loading…
Reference in New Issue
Block a user