-module(dateformat@internal@util). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([to_ordinal/1]). -spec to_ordinal(integer()) -> binary(). to_ordinal(Num) -> case Num of N when N > 100 -> <<(gleam@int:to_string(Num div 100))/binary, (to_ordinal(Num rem 100))/binary>>; N@1 when (N@1 > 3) andalso (N@1 < 20) -> <<(gleam@int:to_string(Num))/binary, "th"/utf8>>; N@2 -> <<(gleam@int:to_string(Num))/binary, (case N@2 rem 10 of 1 -> <<"st"/utf8>>; 2 -> <<"nd"/utf8>>; 3 -> <<"rd"/utf8>>; _ -> <<"th"/utf8>> end)/binary>> end.