feat: Editing large notes (greater than 1.5MB) will result in more optimized syncing, in which changes are saved locally immediately, but sync with the server less frequently (roughly every 30 seconds rather than after every change). (#2768)
This commit is contained in:
28
packages/web/src/javascripts/Utils/GetRelativeTimeString.ts
Normal file
28
packages/web/src/javascripts/Utils/GetRelativeTimeString.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import dayjs from 'dayjs'
|
||||
import RelativeTimePlugin from 'dayjs/plugin/relativeTime'
|
||||
import UpdateLocalePlugin from 'dayjs/plugin/updateLocale'
|
||||
|
||||
dayjs.extend(UpdateLocalePlugin)
|
||||
dayjs.extend(RelativeTimePlugin)
|
||||
|
||||
dayjs.updateLocale('en', {
|
||||
relativeTime: {
|
||||
future: 'in %s',
|
||||
past: '%s ago',
|
||||
s: '%ds',
|
||||
m: 'a minute',
|
||||
mm: '%d minutes',
|
||||
h: 'an hour',
|
||||
hh: '%d hours',
|
||||
d: 'a day',
|
||||
dd: '%d days',
|
||||
M: 'a month',
|
||||
MM: '%d months',
|
||||
y: 'a year',
|
||||
yy: '%d years',
|
||||
},
|
||||
})
|
||||
|
||||
export function getRelativeTimeString(date: Parameters<typeof dayjs>[0]): string {
|
||||
return dayjs(date).fromNow()
|
||||
}
|
||||
Reference in New Issue
Block a user