Skip to content

Instantly share code, notes, and snippets.

@yuttie
Last active July 15, 2021 13:30
Show Gist options
  • Select an option

  • Save yuttie/a7b2195566210764cb8d2e87f28a030a to your computer and use it in GitHub Desktop.

Select an option

Save yuttie/a7b2195566210764cb8d2e87f28a030a to your computer and use it in GitHub Desktop.
Don't use 'months' and 'years' units (up to 'days') in relative times with Day.js
dayjs.extend(relativeTime, {
thresholds: [
{ l: 's', r: 1 },
{ l: 'm', r: 1 },
{ l: 'mm', r: 59, d: 'minute' },
{ l: 'h', r: 1 },
{ l: 'hh', r: 23, d: 'hour' },
{ l: 'd', r: 1 },
{ l: 'dd', d: 'day' },
{ l: 'M' },
{ l: 'MM', d: 'month' },
{ l: 'y' },
{ l: 'yy', d: 'year' }
],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment