OpenHours.Interval (open_hours v0.1.2)

View Source

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

t()

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

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

Functions

difference(a, b)

@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.

within?(interval, instant)

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

Returns true if the interval contains the instant.