When is next Monday

coreutilsdateversion

On my home computer (Xubuntu 14.04), I have

zev@home:~$ date +%F
2015-10-05

zev@home:~$ date +%F -d "next Monday"
2015-10-12

whereas at work (Red Hat 5.11), I have

zev@work:~$ date +%F
2015-10-05

zev@work:~$ date +%F -d "next Monday"
2015-10-05

(Note that today is Monday.) My initial guess was that the different interpretations of the phrase next Monday are due to the systems having different versions of the coreutil date:

zev@home:~$ date --version | head -2
date (GNU coreutils) 8.21
Copyright (C) 2013 Free Software Foundation, Inc.

zev@work:~$ date --version | head -2
date (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.

My questions are:

  • Is the difference in versions of the date program the sole cause, or is there something else about a system that will affect its interpretation of date strings?

  • How can I know whether a system will have one interpretation or the other, without running the commands to check directly? If the only thing that affects the outcome is the version of date, then according to this unix.SE thread (Which version of X introduced feature Y?) I should be able to find which version introduced the new behavior in a changelog for the date program, but I can't find anything remotely like that here (maybe I'm just confused).

Best Answer

I did rpm -qfl /bin/date and looked through the list of files for a changelog, and found /usr/share/doc/coreutils/NEWS and the following paragraph:

  • Noteworthy changes in release 7.4 (2009-05-07) [stable]

    Bug fixes. date -d 'next mon', when run on a Monday, now prints the date 7 days in the future rather than the current day. Same for any other day-of-the-week name, when run on that same day of the week. [This bug appears to have been present in "the beginning". ]

Related Question