Skip to content

Commit

Permalink
docs(date): update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Dec 28, 2022
1 parent d610a8a commit 2077cf1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/date/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ For Node.js REPL:
const date = await import("@thi.ng/date");
```

Package sizes (brotli'd, pre-treeshake): ESM: 5.07 KB
Package sizes (brotli'd, pre-treeshake): ESM: 5.12 KB

## Dependencies

Expand Down Expand Up @@ -296,6 +296,16 @@ withLocale(DE_LONG, () => formatRelativeParts("2020-01-01 12:34"))
// returns tuple of: [sign, years, months, days, hours, mins, secs, millis]
decomposeDifference("2020-01-01 12:34", Date.now())
// [-1, 1, 6, 15, 23, 38, 9, 703]

// format a duration (in ms), optionally with given precision
formatDuration(45296000)
// "12 h, 34 min, 56 s"

formatDuration(45296000, "h")
// "13 h"

formatDuration(45296000,"d")
// "< 1 d"
```

### Date & time formatters
Expand Down
10 changes: 10 additions & 0 deletions packages/date/tpl.readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,16 @@ withLocale(DE_LONG, () => formatRelativeParts("2020-01-01 12:34"))
// returns tuple of: [sign, years, months, days, hours, mins, secs, millis]
decomposeDifference("2020-01-01 12:34", Date.now())
// [-1, 1, 6, 15, 23, 38, 9, 703]

// format a duration (in ms), optionally with given precision
formatDuration(45296000)
// "12 h, 34 min, 56 s"

formatDuration(45296000, "h")
// "13 h"

formatDuration(45296000,"d")
// "< 1 d"
```

### Date & time formatters
Expand Down

0 comments on commit 2077cf1

Please sign in to comment.