Current section

Files

Jump to
gtempo src tempo@year.erl
Raw

src/tempo@year.erl

-module(tempo@year).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-export([is_leap_year/1, days/1]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(
" Functions to use with the `Year` type in Tempo. Years are pretty simple\n"
" thankfully.\n"
).
-file("src/tempo/year.gleam", 19).
?DOC(
" Checks if a year is a leap year.\n"
" \n"
" ## Examples\n"
" \n"
" ```gleam\n"
" year.is_leap_year(2024)\n"
" // -> True\n"
" ```\n"
" \n"
" ```gleam\n"
" year.is_leap_year(2025)\n"
" // -> False\n"
" ```\n"
).
-spec is_leap_year(integer()) -> boolean().
is_leap_year(Year) ->
tempo:is_leap_year(Year).
-file("src/tempo/year.gleam", 36).
?DOC(
" Get the number of days in a year. Accounts for leap years.\n"
" \n"
" ## Examples\n"
" \n"
" ```gleam\n"
" year.days(2024)\n"
" // -> 366\n"
" ```\n"
" \n"
" ```gleam\n"
" year.days(2025)\n"
" // -> 365\n"
" ```\n"
).
-spec days(integer()) -> integer().
days(Year) ->
tempo:year_days(Year).