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.
13 # # For International Atomic Time (TAI), use offsets from UTC provided in `/usr/share/zoneinfo/leap-seconds.list`.
19 if ! ((n_ln
% "$skip_every")); then
23 }; # periodically print separating blank line
31 # Depends: printf, date
32 # Ref/Attrib: * Truncate string in printf https://stackoverflow.com/a/46812677
33 local s_1 s_2 s_3 s_4
;
36 s_2
="$(date "$@
" "$fs_1")";
37 s_3
="$(date "$@
" "$fs_2")";
38 s_4
="$(date "$@
" "$fs_3")";
40 printf "%-10.10s %-25.25s (%-20.20s) (%s)" "$s_1" "$s_2" "$s_3" "$s_4";
43 unset fs_1 fs_2 fs_3 fs_4
;
44 }; # print line of dates
46 n_ln
=0; # for line_sep()
49 fs_iso8601
="+%Y-%m-%dT%H:%M:%S%:::z"; # typical ISO-8601
50 fs_iso8601_etc
="+%G-W%V-%u, %Y-%j"; # alternate ISO-8601 dates
51 fs_locale
="+%Z; %A; %c"; # locale-specific date strings
53 # vars for print_dateline()
55 fs_2
="$fs_iso8601_etc";
58 # UTC (pop. (2021): 7,837,000,000)
62 fs_3
="+%s seconds since 1970-01-01T00:00+00";
69 export LANG
="haw-US.UTF8";
76 export TZ
=America
/Los_Angeles
;
77 export LANG
="en_US.UTF-8";
82 # Denver, USA (pop. (2021): 711,463)
84 export TZ
=America
/Denver
;
85 export LANG
="en_US.UTF-8";
90 # Chicago, USA (pop. (2021): 711,463)
92 export TZ
=America
/Chicago
;
93 export LANG
="en_US.UTF-8";
98 # Mexico City, Mexico (pop. (2018): 21,804,515)
100 export TZ
=America
/Mexico_City
;
101 export LANG
="es_MX.UTF8";
106 # Panama City, Panama
108 export TZ
=America
/Panama
;
109 export LANG
="es_PA.UTF8";
114 # New York, USA (pop. (2018): 20,140,470)
116 export TZ
=America
/New_York
;
117 export LANG
="en_US.UTF-8";
124 export TZ
=America
/Sao_Paulo
;
125 export LANG
="pt_BR.UTF8";
132 export TZ
=America
/Argentina
/Buenos_Aires
;
133 export LANG
="es_AR.UTF8";
140 export TZ
=Europe
/London
;
141 export LANG
="en_GB.UTF-8";
148 export TZ
=Africa
/Kinshasa
;
149 export LANG
="ln_CD.UTF8";
156 export TZ
=Africa
/Lagos
;
157 export LANG
="en_NG.UTF8";
164 export TZ
=Europe
/Paris
;
165 export LANG
="fr_FR.UTF8";
172 export TZ
=Europe
/Stockholm
;
173 export LANG
="sv_SE.UTF8";
180 export TZ
=Africa
/Cairo
;
181 export LANG
="ar_EG.UTF8";
186 # Athens (pop. (2020): 3,526,887)
188 export TZ
=Europe
/Athens
;
189 export LANG
="el_GR.UTF8";
194 # Istanbul (pop. (2020): 13,719,061)
196 export TZ
=Asia
/Istanbul
;
197 export LANG
="tr_TR.UTF8";
204 export TZ
=Asia
/Tehran
;
205 export LANG
="fa_IR.UTF8";
212 export TZ
=Europe
/Moscow
;
213 export LANG
="ru_RU.UTF-8";
218 # Kyiv, Ukraine (pop. (2021): 2,962,180)
220 export TZ
=Europe
/Kyiv
;
221 export LANG
="uk_UA.UTF-8";
226 # Delhi, India (pop. (2018): 29,000,000)
228 export TZ
=Asia
/Kolkata
;
229 export LANG
="hi_IN.UTF-8";
234 # Jakarta, Indonesia (pop. (2018): 33,430,285)
236 export TZ
=Asia
/Jakarta
;
237 export LANG
="id_ID.UTF8";
242 # Singapore, Singapore (pop (2018): 5,792,000)
244 export TZ
=Asia
/Singapore
;
245 export LANG
="en_SG.UTF-8";
250 # Beijing, China (pop. (2018): 19,618,000)
252 export TZ
=Asia
/Shanghai
; # [3]
253 export LANG
="zh_CN.UTF-8";
258 # Tokyo, Japan (pop. (2018): 37,274,000)
260 export TZ
=Asia
/Tokyo
;
261 export LANG
="ja_JP.UTF8";
266 # Seoul, South Korea (pop. (2018): 25,514,000)
268 export TZ
=Asia
/Seoul
;
269 export LANG
="ko_KR.UTF8";
276 export TZ
=Australia
/Sydney
;
277 export LANG
="en_AU.UTF8";
284 export TZ
=Pacific
/Guam
;
285 export LANG
="en_GU.UTF8";
290 # Auckland, New Zealand
292 export TZ
=Pacific
/Auckland
;
293 export LANG
="en_NZ.UTF8";