Current section
Files
Jump to
Current section
Files
src/dateformat@internal@month.erl
-module(dateformat@internal@month).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([to_month_num/1, to_short_month/1, to_ordinal_month/1, to_long_month/1]).
-spec to_month_num(birl:month()) -> integer().
to_month_num(Month) ->
case Month of
jan ->
1;
feb ->
2;
mar ->
3;
apr ->
4;
may ->
5;
jun ->
6;
jul ->
7;
aug ->
8;
sep ->
9;
oct ->
10;
nov ->
11;
dec ->
12
end.
-spec to_short_month(birl:month()) -> binary().
to_short_month(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.
-spec to_ordinal_month(birl:month()) -> binary().
to_ordinal_month(Month) ->
Month_num = to_month_num(Month),
dateformat@internal@util:to_ordinal(Month_num).
-spec to_long_month(birl:month()) -> binary().
to_long_month(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.