Add support for year and complete short date formats

i.e. can now return 2024 and Thursday, April 1
This commit is contained in:
Ilia Ross
2024-04-09 23:44:45 +03:00
parent 1648384ce8
commit 2fce5e752e

View File

@@ -2224,7 +2224,9 @@ if (!$@ && $] > 5.011) {
$data->{'complete'} .= "$_ "
}
};
$data->{'year'} = DateTime->from_epoch(locale => $locale_name_loaded, epoch => $secs, time_zone => $tz)->strftime("%Y");
$data->{'complete'} =~ s/(\d+):(\d+):(\d+)(.*?)/$1:$2$4/;
($data->{'complete_short'} = $data->{'complete'}) =~ s/(.*?)([\s\,]*\Q$data->{'year'}\E.*)/$1/;
if ($opts->{'get'}) {
return $data->{$opts->{'get'}};