BinanceSpotRest.Validators.TimeZone (Binance Spot Rest v0.2.1)

View Source

Internal

Validates timeZone values.

Supported formats:

  • Hours only (e.g. "0", "8", "4", "-1")
  • Hours and minutes (e.g. "-1:00", "05:45", "+10:30")

The accepted range is strictly from -12:00 to +14:00 (inclusive).

Summary

Functions

Returns :ok if tz is a valid time zone, {:error, reason} otherwise.

Functions

validate(value)

Returns :ok if tz is a valid time zone, {:error, reason} otherwise.

Examples

iex> BinanceSpotRest.Validators.TimeZone.validate("05:45")
:ok

iex> BinanceSpotRest.Validators.TimeZone.validate("-1")
:ok

iex> {:error, _} = BinanceSpotRest.Validators.TimeZone.validate("15")

iex> {:error, _} = BinanceSpotRest.Validators.TimeZone.validate("invalid")