You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to create a new locale and pass in thresholds such that '23 hours ago' would be '23h' and anything less than 24hours would not show up as days.
Code
`import dayjs from '@/js/be/dayJSPlugins.js';
Describe the bug
Trying to create a new locale and pass in thresholds such that '23 hours ago' would be '23h' and anything less than 24hours would not show up as days.
Code
`import dayjs from '@/js/be/dayJSPlugins.js';
const localeObject = {
name: 'en-segment',
relativeTime: {
future: 'in %s',
past: '%s',
s: '%ds',
m: '%dm',
mm: '%dm',
h: '%dh',
hh: '%dh',
d: '%dd',
dd: '%dd',
M: '%dM',
MM: '%dM',
y: '%dy',
yy: '%dy',
},
};
export function getRelativeTime(timestamp) {
dayjs.locale('en-segment', localeObject);
delete relativeTime.$i // this allow plugin to be installed again
dayjs.extend(relativeTime, {
rounding: Math.floor,
thresholds: [
{ l: 's', r: 60 },
{ l: 'm', r: 60 },
{ l: 'h', r: 24 },
],
});
return dayjs.unix(timestamp).fromNow();
}
`
Information
The text was updated successfully, but these errors were encountered: