Skip to content

Commit 04ab861

Browse files
committed
Update documentation
1 parent a87349f commit 04ab861

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,25 @@ foo = FooWithTimeSpan.from_yaml("span: 1 hour, 15 minutes")
4646
foo.ttl # => 01:15:00
4747
```
4848

49+
> [!TIP]
50+
> Allowed suffixes:
51+
>
52+
> - week: `w`, `week(s)`
53+
> - day: `d`, `day(s)`
54+
> - hour: `h`, `hour(s)`
55+
> - minute: `m`, `min`, `minute(s)`
56+
> - second: `s`, `sec`, `second(s)`
57+
> - nanosecond: `ns`, `nanosecond(s)`
58+
59+
> [!TIP]
60+
> Valid string examples:
61+
>
62+
> - `1w2d3h4m5s`
63+
> - `1w 2d 3h 4m 5s`
64+
> - `1w 2d 3h 4 min 5 sec`
65+
> - `1 week 2 days 3 hours 4 minutes 5 seconds`
66+
> - `1 week, 2 days, 3 hours, 4 minutes, 5 seconds`
67+
4968
## Contributing
5069

5170
1. Fork it (<https://github.com/Sija/tssc.cr/fork>)

src/core_ext/time/span.cr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# A module for converting time span strings into `Time::Span` objects and
2+
# the other way around.
13
module Time::Span::StringConverter
24
private PATTERN = %r{
35
(?:(?<sign>[+-])\s*)?

0 commit comments

Comments
 (0)