## Summary For some specific dates (and maybe time zones) using `date` to get the time and date of the previous Sunday returns a Saturday instead. ## Steps to reproduce I tried this on Mac OS X 10.9.3, as I do not have a FreeBSD system. I am sure all steps can be reproduced with FreeBSD, I just cannot instruct you how. 1. In System Preferences > Date & Time, deactivate the setting to set time and date automatically from a remote server. 2. Set you timezone to US/Pacific (Los Angeles, CA; I have not tried with other timezones) and your date and time to **Friday, 2014 March 14, 23:30**. 3. In Terminal, run: date -j -v-sun and take note of the output. 4. Set your time to 1 hour later, i.e. **Saturday, 2014 March 15, 00:30**, and run the same command again, taking note of the output. 5. Again, set again your date and time to 1 hour later, i.e. **Saturday, 2014 March 15, 01:30**, and run the same command again, taking note of the output. ## Expected result The date returned should be the same on 3, 4 & 5, only the hour changing (it being the same as the one you set it to, within seconds). I.e.: 3: Sun Mar 9 23:30:00 PST 2014 4: Sun Mar 9 00:30:00 PST 2014 5: Sun Mar 9 01:30:00 PST 2014 ## Actual results Only for the moment in the middle, **Saturday, 2014 March 15, from 00:00:00 to 00:59:59**, the command returns the previous Saturday instead of the previous Sunday: 3: Sun Mar 9 00:30:00 PST 2014 4: Sat Mar 8 23:30:00 PST 2014 5: Sun Mar 9 00:30:00 PST 2014 #Note Probably it has to do with the change to/from Daylight Saving Time, which for US/Pacific is **Sunday, March 9, 02:00** and **Sunday, November 2, 2:00**. The command is not requesting the date of today minus 1 week, though, but the date of the previous Sunday, so it should return a Sunday irrespective of any change from/to Daylight Saving Time. Don’t trust the "Version" field in this bug report as I do not know what FreeBSD’s version of `date` Mac OS X 10.9.3 uses.
I typed them wrong the hours and minutes in _Actual results_. Should have been: 3: Sun Mar 9 23:30:00 PDT 2014 4: Sat Mar 8 23:30:00 PST 2014 5: Sun Mar 9 00:30:00 PST 2014
[10020 root@gravity (100%) /home/eitan !1!]#date -j -v-sun Sun Mar 9 22:30:07 PDT 2014 [10021 root@gravity (100%) /home/eitan ]#date "201403142230.00" Fri Mar 14 22:30:00 PDT 2014 [10022 root@gravity (100%) /home/eitan !2!]#date -j -v-sun Sun Mar 9 22:30:01 PDT 2014 [10023 root@gravity (100%) /home/eitan ]#date "201403150030.00" Sat Mar 15 00:30:00 PDT 2014 [10024 root@gravity (100%) /home/eitan !2!]#date -j -v-sun Sat Mar 8 23:30:01 PST 2014 [10025 root@gravity (100%) /home/eitan ]#date "201403150130.00" Sat Mar 15 01:30:00 PDT 2014 [10026 root@gravity (100%) /home/eitan !2!]#date -j -v-sun Sun Mar 9 00:30:01 PST 2014
Closing since the report is for MacOS, not even FreeBSD