5.8.0 • Published 1 year ago

timerel v5.8.0

Weekly downloads
-
License
BSD-2-Clause
Repository
github
Last release
1 year ago

timerel

npm.io npm.io npm.io npm.io

timerel formats dates to short english relative format 5 mins ago and does so around 11 times faster than its competition.

Usage

import {timerel} from "timerel";

console.log(timerel(Date.now() - 1e6));
// => 16 mins ago

API

timerel(date, opts?)

  • date String, Number or Date: The date to format.

Options

  • now String, Number or Date: The date to compare to. Default: Date.now().
  • noAffix Boolean: Whether to omit ago and in affixes. Default: false.
  • times Array: A custom time table that overrides the built-in one.
  • nowThreshold Number: Number of milliseconds below which to output "now". Default: 2000.
  • nowString String: String to output for now. Default: "now".
  • unknownString String: String to output for invalid dates. Default: String(date).
  • aliases Boolean: Use aliases like "yesterday" instead of "1 day ago". Default: false.
  • aliasesMap Object: A custom aliases object to use instead of the built-in one.
  • longUnits Boolean: Use minutes/secoonds instead of mins/secs. Default: false.

© silverwind, distributed under BSD licence

5.8.0

1 year ago

5.7.0

1 year ago

5.6.3

1 year ago

5.6.2

1 year ago

5.6.0

1 year ago

5.6.1

1 year ago

5.5.0

1 year ago

5.4.2

2 years ago

5.4.3

2 years ago

5.4.1

2 years ago

5.0.6

3 years ago

5.0.5

3 years ago

5.4.0

3 years ago

5.3.0

3 years ago

5.2.0

3 years ago

5.1.0

3 years ago

5.0.4

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.0.3

3 years ago

4.0.2

3 years ago

4.0.1

3 years ago

4.0.0

3 years ago

3.0.0

3 years ago

2.2.0

3 years ago

2.1.1

3 years ago

2.1.0

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago