2 # Desc: Baltakatei's verbose date command
3 # Usage: bkdatev [args]
4 # Example: bkdatev --date="2001-09-11T09:02:59-04"
6 # Ref/Attrib: [1] "ISO 8601". Wikipedia. https://en.wikipedia.org/wiki/ISO_8601
7 # [2] "Changing the Locale in Wine" https://stackoverflow.com/a/16428951
8 # [3] "Shanghai vs Beijing" https://bugs.launchpad.net/ubuntu/+source/libgweather/+bug/228554
9 # Notes: * Check `ls -R /usr/share/zoneinfo` for time zone names.
10 # * Check `cat /usr/share/i18n/SUPPORTED` for supported locales.
11 # * For list of valid locales, see: https://manpages.ubuntu.com/manpages/bionic/man3/DateTime::Locale::Catalog.3pm.html
12 # * Locations chosen for population, personal signifiance, and spatial coverage.
18 if ! ((n_ln
% "$skip_every")); then
22 }; # periodically print separating blank line
30 # Depends: printf, date
31 # Ref/Attrib: * Truncate string in printf https://stackoverflow.com/a/46812677
32 local s_1 s_2 s_3 s_4
;
35 s_2
="$(date "$@
" "$fs_1")";
36 s_3
="$(date "$@
" "$fs_2")";
37 s_4
="$(date "$@
" "$fs_3")";
39 printf "%-10.10s %-25.25s (%-20.20s) (%s)" "$s_1" "$s_2" "$s_3" "$s_4";
42 unset fs_1 fs_2 fs_3 fs_4
;
43 }; # print line of dates
45 n_ln
=0; # for line_sep()
48 fs_iso8601
="+%Y-%m-%dT%H:%M:%S%:::z"; # typical ISO-8601
49 fs_iso8601_etc
="+%G-W%V-%u, %Y-%j"; # alternate ISO-8601 dates
50 fs_locale
="+%Z; %A; %c"; # locale-specific date strings
52 # vars for print_dateline()
54 fs_2
="$fs_iso8601_etc";
57 # UTC (pop. (2021): 7,837,000,000)
67 export LANG
="haw-US.UTF8";
74 export TZ
=America
/Los_Angeles
;
75 export LANG
="en_US.UTF-8";
80 # Denver, USA (pop. (2021): 711,463)
82 export TZ
=America
/Denver
;
83 export LANG
="en_US.UTF-8";
88 # Chicago, USA (pop. (2021): 711,463)
90 export TZ
=America
/Chicago
;
91 export LANG
="en_US.UTF-8";
96 # Mexico City, Mexico (pop. (2018): 21,804,515)
98 export TZ
=America
/Mexico_City
;
99 export LANG
="es_MX.UTF8";
104 # Panama City, Panama
106 export TZ
=America
/Panama
;
107 export LANG
="es_PA.UTF8";
112 # New York, USA (pop. (2018): 20,140,470)
114 export TZ
=America
/New_York
;
115 export LANG
="en_US.UTF-8";
122 export TZ
=America
/Sao_Paulo
;
123 export LANG
="pt_BR.UTF8";
130 export TZ
=America
/Argentina
/Buenos_Aires
;
131 export LANG
="es_AR.UTF8";
138 export TZ
=Europe
/London
;
139 export LANG
="en_GB.UTF-8";
146 export TZ
=Africa
/Kinshasa
;
147 export LANG
="ln_CD.UTF8";
154 export TZ
=Africa
/Lagos
;
155 export LANG
="en_NG.UTF8";
162 export TZ
=Europe
/Paris
;
163 export LANG
="fr_FR.UTF8";
170 export TZ
=Europe
/Stockholm
;
171 export LANG
="sv_SE.UTF8";
178 export TZ
=Africa
/Cairo
;
179 export LANG
="ar_EG.UTF8";
184 # Athens (pop. (2020): 3,526,887)
186 export TZ
=Europe
/Athens
;
187 export LANG
="el_GR.UTF8";
192 # Istanbul (pop. (2020): 13,719,061)
194 export TZ
=Asia
/Istanbul
;
195 export LANG
="tr_TR.UTF8";
202 export TZ
=Asia
/Tehran
;
203 export LANG
="fa_IR.UTF8";
210 export TZ
=Europe
/Moscow
;
211 export LANG
="ru_RU.UTF-8";
216 # Kyiv, Ukraine (pop. (2021): 2,962,180)
218 export TZ
=Europe
/Kyiv
;
219 export LANG
="uk_UA.UTF-8";
224 # Delhi, India (pop. (2018): 29,000,000)
226 export TZ
=Asia
/Kolkata
;
227 export LANG
="hi_IN.UTF-8";
232 # Jakarta, Indonesia (pop. (2018): 33,430,285)
234 export TZ
=Asia
/Jakarta
;
235 export LANG
="id_ID.UTF8";
240 # Singapore, Singapore (pop (2018): 5,792,000)
242 export TZ
=Asia
/Singapore
;
243 export LANG
="en_SG.UTF-8";
248 # Beijing, China (pop. (2018): 19,618,000)
250 export TZ
=Asia
/Shanghai
; # [3]
251 export LANG
="zh_CN.UTF-8";
256 # Tokyo, Japan (pop. (2018): 37,274,000)
258 export TZ
=Asia
/Tokyo
;
259 export LANG
="ja_JP.UTF8";
264 # Seoul, South Korea (pop. (2018): 25,514,000)
266 export TZ
=Asia
/Seoul
;
267 export LANG
="ko_KR.UTF8";
274 export TZ
=Australia
/Sydney
;
275 export LANG
="en_AU.UTF8";
282 export TZ
=Pacific
/Guam
;
283 export LANG
="en_GU.UTF8";
288 # Auckland, New Zealand
290 export TZ
=Pacific
/Auckland
;
291 export LANG
="en_NZ.UTF8";