human_time v0.1.0 HumanTime View Source
Human Time is a function to convert a string such as “every other tuesday”, “every weekday” or “every friday at 2pm” and convert it into a sequence of date times as allowed by the string.
Link to this section Summary
Functions
Generates a stream of datetimes for the string given
Link to this section Functions
Link to this function
parse(timestring, opts \\ [])
View Source
parse(String.t(), [term()]) :: Enumerable.t()
Generates a stream of datetimes for the string given.
Options
from The datetime from when the sequence will be generated, defaults to the current time.
until The datetime when the sequence will be terminated, defaults to nil. When nil the sequence will never be terminated.
Example
HumanTime.parse("Every wednesday at 1530")
|> Stream.take(3)
|> Enum.to_list
#=> [
#=> #DateTime<2018-08-15 15:30:00.848218Z>,
#=> #DateTime<2018-08-22 15:30:00.848218Z>,
#=> #DateTime<2018-08-29 15:30:00.848218Z>
#=> ]