Skip to content

Commit

Permalink
Minor docs improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
zaccomode committed Oct 25, 2023
1 parent 9a416ac commit 2e23e79
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ console.log(time.toDigital());
// 09:41:40 AM
```

Rounding to a particular precision `p` is also possible, and will by default **round down**. This can be set manually using the `r` parameter, which accepts `"down"`, `"up"` or `"nearest"`:
Rounding to a particular precision `precision`/`p` is also possible, and will by default **round down**. This can be set manually using the `rounding`/`r` parameter, which accepts `"down"`, `"up"` or `"nearest"`:
```ts
console.log(time.round({ p: "m" }).toDigital());
// 09:41:00 AM
console.log(time.round({ precision: "m", rounding: "nearest"}).toDigital());
// 09:42:00 AM
console.log(time.round({ p: "m", r: "nearest"}).toDigital());
// 09:42:00 AM
```
Expand All @@ -50,6 +52,9 @@ console.log(time.toDigital({ p: "ms" }));
Arithmetic can also be performed on times, like so:
```ts
const time = new RealTime(9, 35, 40);
console.log(time.add({ unit: "m", value: 3 }).toDigital());
// 09:38:40 AM
// OR
console.log(time.add({ u: "m", v: 3 }).toDigital());
// 09:38:40 AM

Expand Down

0 comments on commit 2e23e79

Please sign in to comment.