Package: coreutils Version: 8.13-3.5 Severity: normal Tags: upstream Dear Maintainer, consider the following 'date' invocations:
$ date -d '1:00 + 14 days' Sat Apr 9 13:00:00 CEST 2016 $ date -d '1:00 am + 14 days' Sat Apr 23 01:00:00 CEST 2016 $ date -d '1:00 pm + 14 days' Sat Apr 23 13:00:00 CEST 2016 $ date Sat Apr 9 12:44:58 CEST 2016 I would expect '1:00 + 14 days' to mean one hour past midnight local time on the day two weeks after today's date, i.e. 23 April. The '+ 14 days' part is ignored, however. In addition, the time returned is 13 hours past midnight, not one hour. Strangely enough, appending 'am' to the time string fixes both the date and the time. At least the following versions of 'date' are affected: date (GNU coreutils) 8.13 (Debian GNU/Linux 7) date (GNU coreutils) 8.21 (Ubuntu 14.04.3 LTS) I suspect the bug to be present upstream as well. And I am all for implementing a simple and regular grammmar as you suggested in a follow-up message to another bug report, cf. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=729952#10 In fact, wouldn't it be possible to let users choose between the traditional parser and the yet-to-be written one by using a command-line option? The '-D' switch does not appear in the 'date' manual page, so I'm taking credit for suggesting using it. :) I'm confident I can come up with a specification for most of the date and time items currently understood by 'date' that avoids pitfalls like those below (second vs 2nd etc.) by being unambiguous and that is easy to parse. Where do I sign up? $ date -d 'first Monday' Mon Apr 11 00:00:00 CEST 2016 $ date -d 'second Monday' Mon Apr 11 00:00:01 CEST 2016 $ date -d 'third Monday' Mon Apr 25 00:00:00 CEST 2016 (The first Monday in April should be April 4th, shouldn't it? The 'date' info page is lacking in this regard.) Regards, Thure Dührsen -- System Information: Debian Release: 7.9 APT prefers oldstable-updates APT policy: (500, 'oldstable-updates'), (500, 'oldstable') Architecture: i386 (i686) Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages coreutils depends on: ii dpkg 1.16.17 ii install-info 4.13a.dfsg.1-10 ii libacl1 2.2.51-8 ii libattr1 1:2.4.46-8 ii libc6 2.13-38+deb7u10 ii libselinux1 2.1.9-5 coreutils recommends no packages. coreutils suggests no packages. -- no debconf information