View Source Luminous.TimeRange behaviour (luminous v2.3.1)

This module defines a struct with two fields (:from and :to) to represent a time range. Additionally, various helper functions are defined that operate on time ranges.

It also specifies a behaviour that can be (optionally) implemented by client-side dashboards in order to override the dashboard's default time range (which is "today").

Link to this section Summary

Callbacks

Implement inside a client-side dashboard in order to return the dashboard's default time range.

Link to this section Types

@type t() :: %Luminous.TimeRange{from: DateTime.t(), to: DateTime.t()}
@type time_zone() :: binary()

Link to this section Callbacks

Link to this callback

default_time_range(time_zone)

View Source
@callback default_time_range(time_zone()) :: t()

Implement inside a client-side dashboard in order to return the dashboard's default time range.

Link to this section Functions

@spec add(DateTime.t(), integer(), atom()) :: DateTime.t()
@spec default(time_zone()) :: t()
@spec default_time_zone() :: time_zone()
Link to this function

from_iso(from_iso, to_iso)

View Source
@spec from_iso(binary(), binary()) :: t()
Link to this function

from_unix(from_unix, to_unix)

View Source
@spec from_unix(non_neg_integer(), non_neg_integer()) :: t()
Link to this function

last_month(tz, now \\ nil)

View Source
@spec last_month(time_zone(), DateTime.t() | nil) :: t()
Link to this function

last_n_days(n, tz, now \\ nil)

View Source
@spec last_n_days(non_neg_integer(), time_zone(), DateTime.t() | nil) :: t()
Link to this function

last_week(tz, now \\ nil)

View Source
@spec last_week(time_zone(), DateTime.t() | nil) :: t()
@spec new(DateTime.t(), DateTime.t()) :: t()
@spec round(DateTime.t(), atom()) :: DateTime.t()
Link to this function

shift_zone!(time_range, time_zone)

View Source
@spec shift_zone!(t(), time_zone()) :: t()
Link to this function

this_month(tz, now \\ nil)

View Source
@spec this_month(time_zone(), DateTime.t() | nil) :: t()
Link to this function

this_week(tz, now \\ nil)

View Source
@spec this_week(time_zone(), DateTime.t() | nil) :: t()
@spec to_map(t()) :: map()
@spec today(time_zone(), DateTime.t() | nil) :: t()
Link to this function

tomorrow(tz, now \\ nil)

View Source
@spec tomorrow(time_zone(), DateTime.t() | nil) :: t()
Link to this function

yesterday(tz, now \\ nil)

View Source
@spec yesterday(time_zone(), DateTime.t() | nil) :: t()