View Source Luminous.TimeRangeSelector (luminous v2.3.0)

A selector supports the widget in the dashboard that allows for selecting a time range/period. It can also be updated with a new value.

Link to this section Summary

Functions

Calculates and returns the time range for the given preset in the given time zone.

Create and return a new selector

Returns a list with the available time range presets.

Updates the current time range of the selector.

Link to this section Types

@type preset() :: binary()
@type t() :: %Luminous.TimeRangeSelector{
  current_time_range: nil | Luminous.TimeRange.t(),
  id: term()
}

Link to this section Functions

Link to this function

get_time_range_for(preset, time_zone)

View Source
@spec get_time_range_for(preset(), Luminous.TimeRange.time_zone()) ::
  Luminous.TimeRange.t() | nil

Calculates and returns the time range for the given preset in the given time zone.

@spec new(t()) :: t()

Create and return a new selector

@spec presets() :: [preset()]

Returns a list with the available time range presets.

Link to this function

update_current(selector, time_range)

View Source
@spec update_current(t(), Luminous.TimeRange.t()) :: t()

Updates the current time range of the selector.