X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/b29fc43b4fc448c2b198b02dd560d67dac61de6a..79cb35dcab82101c36b5035f242d39d0e1593767:/user/bkdatev?ds=sidebyside diff --git a/user/bkdatev b/user/bkdatev old mode 100755 new mode 100644 index f2f92ec..1b80477 --- a/user/bkdatev +++ b/user/bkdatev @@ -2,7 +2,8 @@ # Desc: Baltakatei's verbose date command # Usage: bkdatev [args] # Example: bkdatev --date="2001-09-11T09:02:59-04" -# Version: 0.3.0 +# Version: 0.3.2 +# Depends: GNU Coreutils 8.32, Bash 3.2.57 # Ref/Attrib: [1] "ISO 8601". Wikipedia. https://en.wikipedia.org/wiki/ISO_8601 # [2] "Changing the Locale in Wine" https://stackoverflow.com/a/16428951 # [3] "Shanghai vs Beijing" https://bugs.launchpad.net/ubuntu/+source/libgweather/+bug/228554 @@ -11,6 +12,9 @@ # * For list of valid locales, see: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::Locale::Catalog.3pm.html # * Locations chosen for population, personal signifiance, and spatial coverage. # * For International Atomic Time (TAI), use offsets from UTC provided in `/usr/share/zoneinfo/leap-seconds.list`. +# * Compatibility with macOS may be limited if any arguments +# are provided when running `bkdatev`; e.g. passing a +# `--date` option to `bkdatev` will fail. yell() { echo "$0: $*" >&2; } die() { yell "$*"; exit 111; } @@ -83,7 +87,9 @@ get_tz_offset() { #last2="$(rev <<< $ntz)" && last2="${last2:0:2}" && last2="$(rev <<< "$last2")"; if [[ "$last2" == "00" ]]; then ## ntz_out is truncated by 2 characters - ntz_out="${ntz:0:-2}"; + len_ntz="${#ntz}"; + len_ntz_out="$(( len_ntz - 2 ))"; + ntz_out=""${ntz:0:$len_ntz_out}; else ## ntz_out is ntz with semicolon inserted after HH ntz_out="$(insertStr "$ntz" 3 ":" )";