I ran the following expecting it to provide me with the date 35 years
ago

  date -d "now - 35 years"

Instead I received the error:

  date: invalid date ‘now - 35 years’

Testing it further I found that the break point is at 24 years:

$ date --version
date (GNU coreutils) 8.32
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
$ date -d "now - 23 years"
Tue Apr 28 03:20:37 PM EST 1998
$ date -d "now - 24 years"
date: invalid date ‘now - 24 years’
$

I compiled from the latest coreutils source and found it to have
the same issue:

$ cd coreutils/src/
$ ./date --version
date (GNU coreutils) 8.32.143-62a7c
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.
$ date "now - 23 years"
date: invalid date ‘now - 23 years’
$ date -d "now - 23 years"
Tue Apr 28 03:21:09 PM EST 1998
$ date -d "now - 24 years"
date: invalid date ‘now - 24 years’
$


I found that this did work on a system running coreutils 8.23 so
something seems to have broken since then. These are all Linux systems
that I've tried this on. The system I tested on was a fresh Ubuntu 21.04
VM.

Linux ubuntu2104 5.11.0-16-generic #17-Ubuntu SMP Wed Apr 14 20:12:43 UTC 2021 
x86_64 x86_64 x86_64 GNU/Linux

Thanks,
Mark
 



Reply via email to