diff options
author | Thomas Voss <mail@thomasvoss.com> | 2025-06-06 03:18:37 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2025-06-06 03:18:37 +0200 |
commit | f414da538cc2fc1c41d88d5f06ae4eff08848729 (patch) | |
tree | 1054d30b88fcbaee5125a728b351f8210bdc9882 | |
parent | fe93f0d9e380fc1652c1c5d88dce166007bc52f0 (diff) |
Add the ‘datefmt’ script
-rwxr-xr-x | datefmt | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -0,0 +1,19 @@ +#!/bin/sh + +url() +{ + echo "https://raw.githubusercontent.com/unicode-org/cldr-json/refs/heads/main/cldr-json/cldr-dates-full/main/$1/ca-gregorian.json" +} + +if [ $# -lt 1 ] +then + echo "Usage: datefmt locale..." >&2 + exit 1 +fi + +for l in "$@" +do + [ $# -gt 1 ] && printf '%s:\t' "$l" + curl -s "$(url "$l")" | jq -r --arg l "$l" \ + '.main.[$l].dates.calendars.gregorian.dateFormats.short' +done |