(datetime then-dt
&
{:keys [now-dt suffix prefix]
:or {now-dt (jt.ldt/now) suffix "ago" prefix "in"}})
Given a java.time.LocalDate or java.time.LocalDateTime, returns a human-friendly representation of the amount of time elapsed compared to now.
Optional keyword args:
Given a java.time.LocalDate or java.time.LocalDateTime, returns a human-friendly representation of the amount of time elapsed compared to now. Optional keyword args: * :now-dt - specify the value for 'now' * :prefix - adjust the verbiage for times in the future * :suffix - adjust the verbiage for times in the past
(duration duration-ms)
(duration duration-ms options)
Converts duration, in milliseconds, into a string describing it in terms of years, months, weeks, days, hours, minutes, and seconds.
Ex:
(duration 325100) => "five minutes, twenty-five seconds"
The months and years periods are not based on actual calendar, so are approximate; this function works best for shorter periods of time.
The optional options map allow some control over the result.
:list-format (default: a function) can be set to a function such as oxford
:number-format (default: numberword) function used to format period counts
:short-text (default: "less than a second")
Converts duration, in milliseconds, into a string describing it in terms of years, months, weeks, days, hours, minutes, and seconds. Ex: (duration 325100) => "five minutes, twenty-five seconds" The months and years periods are not based on actual calendar, so are approximate; this function works best for shorter periods of time. The optional options map allow some control over the result. :list-format (default: a function) can be set to a function such as oxford :number-format (default: numberword) function used to format period counts :short-text (default: "less than a second")
(filesize bytes & {:keys [binary format] :or {binary false format "%.1f"}})
Format a number of bytes as a human readable filesize (eg. 10 kB). By default, decimal suffixes (kB, MB) are used. Passing :binary true will use binary suffixes (KiB, MiB) instead.
Format a number of bytes as a human readable filesize (eg. 10 kB). By default, decimal suffixes (kB, MB) are used. Passing :binary true will use binary suffixes (KiB, MiB) instead.
(format-delta-str amount time-unit suffix prefix future-time?)
(intcomma num)
Converts an integer to a string containing commas. every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
Converts an integer to a string containing commas. every three digits. For example, 3000 becomes '3,000' and 45000 becomes '45,000'.
(intword num & {:keys [format] :or {format "%.1f"}})
Converts a large integer to a friendly text representation. Works best for numbers over 1 million. For example, 1000000 becomes '1.0 million', 1200000 becomes '1.2 million' and '1200000000' becomes '1.2 billion'. Supports up to decillion (33 digits) and googol (100 digits).
Converts a large integer to a friendly text representation. Works best for numbers over 1 million. For example, 1000000 becomes '1.0 million', 1200000 becomes '1.2 million' and '1200000000' becomes '1.2 billion'. Supports up to decillion (33 digits) and googol (100 digits).
(numberword num)
Takes a number and return a full written string form. For example, 23237897 will be written as "twenty-three million two hundred and thirty-seven thousand eight hundred and ninety-seven".
Takes a number and return a full written string form. For example, 23237897 will be written as "twenty-three million two hundred and thirty-seven thousand eight hundred and ninety-seven".
(ordinal num)
Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc.
Converts an integer to its ordinal as a string. 1 is '1st', 2 is '2nd', 3 is '3rd', etc.
(oxford coll
&
{:keys [maximum-display truncate-noun number-format]
:or {maximum-display 4 number-format str}})
Converts a list of items to a human-readable string, such as "apple, pear, and 2 other fruits".
Options:
:maximum-display - the maximum number of items to display before identifying the remaining count (default: 4)
:truncate-noun - the string used to identify the type of items in the list, e.g., "fruit" - will
be pluralized if necessary
:number-format - function used to format the number of additional items in the list (default: str
)
Converts a list of items to a human-readable string, such as "apple, pear, and 2 other fruits". Options: :maximum-display - the maximum number of items to display before identifying the remaining count (default: 4) :truncate-noun - the string used to identify the type of items in the list, e.g., "fruit" - will be pluralized if necessary :number-format - function used to format the number of additional items in the list (default: `str`)
(truncate string length)
(truncate string length suffix)
Truncate a string with suffix (ellipsis by default) if it is longer than specified length.
Truncate a string with suffix (ellipsis by default) if it is longer than specified length.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close