From f414da538cc2fc1c41d88d5f06ae4eff08848729 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 6 Jun 2025 03:18:37 +0200 Subject: Add the ‘datefmt’ script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- datefmt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 datefmt diff --git a/datefmt b/datefmt new file mode 100755 index 0000000..747b47a --- /dev/null +++ b/datefmt @@ -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 -- cgit v1.2.3