]> git.plutz.net Git - confetti/blobdiff - l10n.sh
introduce localised date parsing
[confetti] / l10n.sh
diff --git a/l10n.sh b/l10n.sh
index 361542e76718d4d07c6c4ee985e0f3a109dcbb17..c53cdd386197b8701ece0392cc85336ac38f4438 100755 (executable)
--- a/l10n.sh
+++ b/l10n.sh
@@ -115,6 +115,7 @@ l10n_global() {
 
     # UI Labels Special
     course_attendance) printf %s "Kurs­teil­nahme";;
+    vcf_seed_label) printf "Anmeld.    Vorn.   Nachn.  Geb. Monat      Geb. Jahr       Tel.    Mobil   ()      EMail   ()      Notiz";;
   
     gender_none) printf %s "keine Angabe";;
     gender_female) printf %s "Weiblich";;
@@ -156,3 +157,20 @@ l10n_time() {
     s;December;De\&shy\;zem\&shy\;ber;g;       s;Dec\.;Dez.;g;
   '
 }
+
+parse_date() {
+  [ $# -eq 0 ] && read -r date || date="$*"
+
+  case $date in
+    *[0-9].*[0-9].*[0-9])
+      d="${date%%.*}"
+      y="${date##*.}"
+      m="${date%.*}"
+      m="${m#*.}"
+      [ $y -lt 100 ] && y="$((y + 2000))"
+      date -d "$(printf '%04i-%02i-%02i' "$y" "$m" "$d")" +%F
+      ;;
+    *) date -d "$date" +%F
+      ;;
+  esac
+}