You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/humanise.gleam
+82-25Lines changed: 82 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
-
//// This module contains a bunch of shortcuts to the `time`, `bytes` and 'bytes1024' modules for directly "humanising" and formatting a number (`Float` or `Int`) to a `String`.
1
+
//// This module contains a bunch of shortcuts to the `time`, `bytes` and 'bytes1024' modules for directly "humanising"
2
+
//// and formatting a number (`Float` or `Int`) to a `String`.
2
3
////
3
-
//// For more control (e.g. work with `time.Time` or `bytes.Bytes` directly, use the given unit instead of the most optimal one), look at the `time`, `bytes` or `bytes1024` modules.
4
+
//// For more control (e.g. work with `time.Time` or `bytes.Bytes` directly, use the given unit instead of the most
5
+
//// optimal one), look at the `time`, `bytes` or `bytes1024` modules.
/// Format a `Timestamp` relative to the provided current `Timestamp`.
16
19
///
17
-
/// This function finds the difference between the current time and the given time, and returns a string describing the difference. (e.g. "in 2.0s", "3.5d ago")
20
+
/// This function finds the difference between the current time and the given time, and returns a string describing the
21
+
/// difference using the provided formatter. (e.g. `"in 2s"`, `"3 days, 12 hours ago"`)
18
22
///
19
-
/// > If you're looking for prettier messages without decimal precision, I recommend the `timeago` package!
/// Format a `Date`, `TimeOfDay` pair, automatically omitting redundant information (omit year if it matches the current year, omit month and day if it also matches the current day)
45
-
///
49
+
/// Format a `Date`, `TimeOfDay` pair, automatically omitting redundant information (omit year if it matches the current
50
+
/// year, omit month and day if it also matches the current day)
51
+
///
46
52
/// The given date will be compared against the provided "current" date to determine what information to omit.
47
53
///
48
-
/// This function does not currently support internationalization, and simply returns a string in the following largest-to-smallest format:
54
+
/// This function does not currently support internationalization, and simply returns a string in the following
0 commit comments