Current section
Files
Jump to
Current section
Files
src/tempo@month.erl
-module(tempo@month).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([to_short_string/1, to_long_string/1, from_short_string/1, from_long_string/1, from_string/1, to_int/1, from_int/1, days/2, next/1, prior/1]).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 31).
-spec to_short_string(tempo:month()) -> binary().
to_short_string(Month) ->
case Month of
jan ->
<<"Jan"/utf8>>;
feb ->
<<"Feb"/utf8>>;
mar ->
<<"Mar"/utf8>>;
apr ->
<<"Apr"/utf8>>;
may ->
<<"May"/utf8>>;
jun ->
<<"Jun"/utf8>>;
jul ->
<<"Jul"/utf8>>;
aug ->
<<"Aug"/utf8>>;
sep ->
<<"Sep"/utf8>>;
oct ->
<<"Oct"/utf8>>;
nov ->
<<"Nov"/utf8>>;
dec ->
<<"Dec"/utf8>>
end.
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 58).
-spec to_long_string(tempo:month()) -> binary().
to_long_string(Month) ->
case Month of
jan ->
<<"January"/utf8>>;
feb ->
<<"February"/utf8>>;
mar ->
<<"March"/utf8>>;
apr ->
<<"April"/utf8>>;
may ->
<<"May"/utf8>>;
jun ->
<<"June"/utf8>>;
jul ->
<<"July"/utf8>>;
aug ->
<<"August"/utf8>>;
sep ->
<<"September"/utf8>>;
oct ->
<<"October"/utf8>>;
nov ->
<<"November"/utf8>>;
dec ->
<<"December"/utf8>>
end.
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 111).
-spec from_short_string(binary()) -> {ok, tempo:month()} |
{error, tempo:error()}.
from_short_string(Month) ->
tempo:month_from_short_string(Month).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 128).
-spec from_long_string(binary()) -> {ok, tempo:month()} | {error, tempo:error()}.
from_long_string(Month) ->
tempo:month_from_long_string(Month).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 93).
-spec from_string(binary()) -> {ok, tempo:month()} | {error, tempo:error()}.
from_string(Month) ->
_pipe = from_short_string(Month),
gleam@result:try_recover(_pipe, fun(_) -> from_long_string(Month) end).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 142).
-spec to_int(tempo:month()) -> integer().
to_int(Month) ->
tempo:month_to_int(Month).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 160).
-spec from_int(integer()) -> {ok, tempo:month()} | {error, tempo:error()}.
from_int(Month) ->
tempo:month_from_int(Month).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 181).
-spec days(tempo:month(), integer()) -> integer().
days(Month, Year) ->
tempo:days_of_month(Month, Year).
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 202).
-spec next(tempo:month()) -> tempo:month().
next(Month) ->
case Month of
jan ->
feb;
feb ->
mar;
mar ->
apr;
apr ->
may;
may ->
jun;
jun ->
jul;
jul ->
aug;
aug ->
sep;
sep ->
oct;
oct ->
nov;
nov ->
dec;
dec ->
jan
end.
-file("/home/john/Repos/tempo/src/tempo/month.gleam", 236).
-spec prior(tempo:month()) -> tempo:month().
prior(Month) ->
case Month of
jan ->
dec;
feb ->
jan;
mar ->
feb;
apr ->
mar;
may ->
apr;
jun ->
may;
jul ->
jun;
aug ->
jul;
sep ->
aug;
oct ->
sep;
nov ->
oct;
dec ->
nov
end.