Skip to content
Snippets Groups Projects
Commit 54f65403 authored by Christian Schaper's avatar Christian Schaper
Browse files

support gMonthDay, gDay

parent a2be1e6e
No related branches found
No related tags found
No related merge requests found
......@@ -51,6 +51,8 @@ declare %private function date:getCastableDate($date as xs:string, $latest as xs
else if($date castable as xs:gYearMonth) then
if($latest) then xs:date(concat($date, '-', functx:days-in-month(xs:date(concat($date,'-01')))))
else xs:date(concat($date,'-01'))
else if($date castable as xs:gMonthDay) then xs:date(concat('9999-', substring-after($date, '--')))
else if($date castable as xs:gDay) then xs:date(concat('9999-12-', substring-after($date, '---')))
else()
};
......@@ -137,6 +139,8 @@ declare function date:printDate($date as element()?, $lang as xs:string, $get-la
if($date/@when castable as xs:date) then date:format-date($date/@when, $picture-string, $lang)
else if($date/@when castable as xs:gYear) then date:formatYear($date/@when, $lang)
else if($date/@when castable as xs:gYearMonth) then date:format-date(date:getCastableDate(data($date/@when),true()),'[MNn] [Y]', $lang)
else if($date/@when castable as xs:gMonthDay) then $get-language-string('noYear',xs:string(date:format-date(date:getCastableDate(data($date/@when),true()),'[D]. [MNn]', $lang)))
else if($date/@when castable as xs:gDay) then $get-language-string('noYearMonth',xs:string(date:format-date(date:getCastableDate(data($date/@when),true()),'[D].', $lang)))
else if($date/@when castable as xs:dateTime) then date:format-date(datetime:date-from-dateTime($date/@when), $picture-string, $lang)
else error($date:DATE_FORMAT_ERROR, 'unsupported value for @when: "' || $date/@when || '".')
(: @when-iso für die busoni-app :)
......@@ -144,6 +148,8 @@ declare function date:printDate($date as element()?, $lang as xs:string, $get-la
if($date/@when-iso castable as xs:date) then date:format-date($date/@when-iso, $picture-string, $lang)
else if($date/@when-iso castable as xs:gYear) then date:formatYear($date/@when-iso, $lang)
else if($date/@when-iso castable as xs:gYearMonth) then date:format-date(date:getCastableDate(data($date/@when-iso),true()),'[MNn] [Y]', $lang)
else if($date/@when-iso castable as xs:gMonthDay) then $get-language-string('noYear',xs:string(date:format-date(date:getCastableDate(data($date/@when-iso),true()),'[D]. [MNn]', $lang)))
else if($date/@when-iso castable as xs:gDay) then $get-language-string('noYearMonth',xs:string(date:format-date(date:getCastableDate(data($date/@when-iso),true()),'[D].', $lang)))
else if($date/@when-iso castable as xs:dateTime) then date:format-date(datetime:date-from-dateTime($date/@when-iso), $picture-string, $lang)
else error($date:DATE_FORMAT_ERROR, 'unsupported value for @when-iso: "' || $date/@when-iso || '".')
else if(exists($notBefore)) then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment