ref: 1eed171cbd11a34201263b0bb29874a03071dedf
dir: /cmd/date.rc/
#!/bin/rc nl=' ' fn check { r=`$nl{seconds $1} if(! ~ $r $2){ >[1=2] echo fail: $1: got $r expected $2 exit 'fail' } } # examples from manpage, and shuffles check '23 may 2011' 1306108800 check 'may 23 2011' 1306108800 check 'may 2011 23' 1306108800 check '23 2011 may' 1306108800 check '2011 may 23' 1306108800 check '2011 23 may' 1306108800 # now with timezones check '23 may 2011 edt' 1306123200 check '23 may 2011 gmt' 1306108800 # now with times check 'may 23 2011 0' 1306108800 check 'may 23 2011 0:1' 1306108860 check 'may 23 2011 0:1:2' 1306108862 # now with times and timezones check '23 may 2011 edt' 1306123200 check '23 may 2011 gmt' 1306108800 # formats from date(1) check 'Sun, 14 Jun 2020 22:08:48 -0700' 1592197728 check 'Sun, 14 Jun 2020 -0700' 1592118000 check '2020-06-14' 1592092800 check '2020-06-14T22:14:17-07:00' 1592198057 # colloquial american format (eww) check '06/14/2020' 1592092800 check '06/01/2020' 1590969600 exit ''