Sebastian Walz 860d31cee1
Tohu vaBohu
2023-04-21 00:22:52 +02:00

34 lines
1.1 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ core, ... }:
let
inherit(core) debug list string time type;
formatDate
= date:
language:
type.matchPrimitiveOrPanic date
{
int = string date;
string = date;
set
= let
from = time.tryParseISO8601 date.from;
till = time.tryParseISO8601 date.till;
in
(debug.info "formatDate" { text = "from"; data = from; })
(debug.info "formatDate" { text = "till"; data = till; })
(
if from != null
&& till != null
&& from.month != null
&& till.month != null
then
"${time.formatYearShortMonth from language}${time.formatYearShortMonth till language}"
else
"${string date.from}${string date.till}"
);
};
in
{
inherit formatDate;
}