View Source OpenHours.Interval (open_hours v0.1.1)

This module contains functions for working with intervals of time.

Summary

Types

t()

A tuple of two Time structs representing the beginning and end of an interval.

Functions

Calculates the difference between two intervals or two lists of intervals.

Returns true if the interval contains the instant.

Types

@type t() :: {Time.t(), Time.t()}

A tuple of two Time structs representing the beginning and end of an interval.

Functions

@spec difference([t()] | t(), [t()] | t()) :: [t()]

Calculates the difference between two intervals or two lists of intervals.

It always returns a list of intervals.

Link to this function

within?(interval, instant)

View Source
@spec within?(t(), DateTime.t() | Time.t()) :: boolean()

Returns true if the interval contains the instant.