From unknown Wed Sep 24 08:26:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12318: gnu date has incorrect date when using date math during a leap year Resent-From: John Mizell Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 31 Aug 2012 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 12318 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 12318@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.134643031820641 (code B ref -1); Fri, 31 Aug 2012 16:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 31 Aug 2012 16:25:18 +0000 Received: from localhost ([127.0.0.1]:59723 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7U22-0005Ms-03 for submit@debbugs.gnu.org; Fri, 31 Aug 2012 12:25:18 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46696) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7SOp-00034H-3q for submit@debbugs.gnu.org; Fri, 31 Aug 2012 10:40:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7SNa-00070t-9p for submit@debbugs.gnu.org; Fri, 31 Aug 2012 10:39:27 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:41654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7SNa-00070n-6p for submit@debbugs.gnu.org; Fri, 31 Aug 2012 10:39:26 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7SNT-0002xC-UR for bug-coreutils@gnu.org; Fri, 31 Aug 2012 10:39:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7SNO-0006z9-Mc for bug-coreutils@gnu.org; Fri, 31 Aug 2012 10:39:19 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:40307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7SNO-0006z5-Hc for bug-coreutils@gnu.org; Fri, 31 Aug 2012 10:39:14 -0400 Received: by iagk10 with SMTP id k10so5811338iag.0 for ; Fri, 31 Aug 2012 07:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=MSYQihJKZyfFUPROtxrRR96HVg1r/zEuiEJDrgpSAaI=; b=vWEJueCoWU0mo4ajNHUM31UDa1ejxAA0kedR6co3pNU1xQD/G+XZTfY/4eBNSWUsSg PcpgvYnFQBRkJfE5P9abbt62R7uKbmi/7T7Rq3RJxN1O2IbBRM5DPN0o/HQpvCoNhkfU qRziya7sxv8QYvCDpcZs2AYbxle3JN3oA/PEXmhKK6qKs7bgRQ7YfloZP/cnYSLfp0+H PbAcGjX6Oo7KV4oiX0LhZmqST1PV44yYXGSId5IS5lVh65GaZ9tdYusb1tCzdbrRJGFy T1fZdgST5SKkedD0GJhwbUpN8809Llnhcxn6k8PxXBGoGuwBCixUhw16aDgxcX7yR33z agHA== MIME-Version: 1.0 Received: by 10.50.158.169 with SMTP id wv9mr3072894igb.25.1346423952932; Fri, 31 Aug 2012 07:39:12 -0700 (PDT) Received: by 10.64.90.36 with HTTP; Fri, 31 Aug 2012 07:39:12 -0700 (PDT) Date: Fri, 31 Aug 2012 08:39:12 -0600 Message-ID: From: John Mizell Content-Type: text/plain; charset=ISO-8859-1 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Mailman-Approved-At: Fri, 31 Aug 2012 12:25:17 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) gnu date has incorrect date when using date math during a leap year Here are the steps to reproduce [jmizell@backdoor ~]$ date "+%m%Y" --date='1 month ago' 072012 [jmizell@backdoor ~]$ date "+%m%Y" --date='5 month ago' 032012 [jmizell@backdoor ~]$ date "+%m%Y" --date='6 month ago' 032012 [jmizell@backdoor ~]$ date "+%m%Y" --date='7 month ago' 012012 [jmizell@backdoor ~]$ date "+%m%d%Y" --date='7 month ago' 01312012 [jmizell@backdoor ~]$ date "+%m%d%Y" --date='5 month ago' 03312012 [jmizell@backdoor ~]$ date "+%m%d%Y" --date='6 month ago' 03022012 Version: [jmizell@backdoor ~]$ date --version date (GNU coreutils) 8.4 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . 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. Distro: CentOS release 6.3 (Final) From unknown Wed Sep 24 08:26:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12318: gnu date has incorrect date when using date math during a leap year Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 31 Aug 2012 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12318 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: John Mizell Cc: 12318@debbugs.gnu.org Received: via spool by 12318-submit@debbugs.gnu.org id=B12318.134643607432357 (code B ref 12318); Fri, 31 Aug 2012 18:02:02 +0000 Received: (at 12318) by debbugs.gnu.org; 31 Aug 2012 18:01:14 +0000 Received: from localhost ([127.0.0.1]:59807 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VWs-0008Pq-5q for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:01:14 -0400 Received: from joseki.proulx.com ([216.17.153.58]:50836) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VWp-0008Pd-2S for 12318@debbugs.gnu.org; Fri, 31 Aug 2012 14:01:12 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 16BD1211D9; Fri, 31 Aug 2012 11:59:53 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id D0AE12DC6F; Fri, 31 Aug 2012 11:59:52 -0600 (MDT) Date: Fri, 31 Aug 2012 11:59:52 -0600 From: Bob Proulx Message-ID: <20120831175952.GB32661@hysteria.proulx.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) John Mizell wrote: > gnu date has incorrect date when using date math during a leap year Thank you for the report. But this appears to be incorrect usage. > Here are the steps to reproduce Thank you very much for providing your reproducing steps. It makes diagnosis easy. So many people do not include enough information. > [jmizell@backdoor ~]$ date "+%m%Y" --date='1 month ago' > 072012 Two problems with the reproducer. One is that you don't tell us what timezone you are in. Dates are very timezone dependent. Secondly +%m%Y does not give enough information. I recommend -R, --rfc-2822 which will produce a standard and unambiguous result. $ TZ=US/Mountain date -R --date='1 month ago' Tue, 31 Jul 2012 11:30:38 -0600 > [jmizell@backdoor ~]$ date "+%m%Y" --date='5 month ago' > 032012 $ TZ=US/Mountain date -R --date='5 month ago' Sat, 31 Mar 2012 11:31:11 -0600 > [jmizell@backdoor ~]$ date "+%m%Y" --date='6 month ago' > 032012 $ TZ=US/Mountain date -R --date='6 month ago' Fri, 02 Mar 2012 10:31:34 -0700 I think at that you you can see where things have gone wrong. The date documentation warns of this case with this information: The fuzz in units can cause problems with relative items. For example, `2003-07-31 -1 month' might evaluate to 2003-07-01, because 2003-06-31 is an invalid date. To determine the previous month more reliably, you can ask for the month before the 15th of the current month. For example: $ date -R Thu, 31 Jul 2003 13:02:39 -0700 $ date --date='-1 month' +'Last month was %B?' Last month was July? $ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!' Last month was June! Also the FAQ entry goes into some detail on this issue: http://www.gnu.org/software/coreutils/faq/coreutils-faq.html#The-date-command-is-not-working-right_002e Months are problematic because subtracting 30 days (or even 31 days) does not equate to a correct answer for everyone. There is no solution that everyone will agree is correct. On March 1st subtracting 30 days will yield a result of January. As warned in the documentation month calculations are better done at the time of the middle of the month to avoid those issues. At the least you should include a time of day so that the time that math is being done isn't being done near a daylight savings time change. Taking that into consider and improving the usage yields: $ TZ=US/Mountain date -R --date='today 12:00z 6 month ago' Fri, 02 Mar 2012 05:00:00 -0700 $ for i in 1 2 3 4 5 6 7 8; do date -R --date="2012-08-15 12:00 -0600 $i months ago";done Sun, 15 Jul 2012 12:00:00 -0600 Fri, 15 Jun 2012 12:00:00 -0600 Tue, 15 May 2012 12:00:00 -0600 Sun, 15 Apr 2012 12:00:00 -0600 Thu, 15 Mar 2012 12:00:00 -0600 Wed, 15 Feb 2012 11:00:00 -0700 Sun, 15 Jan 2012 11:00:00 -0700 Thu, 15 Dec 2011 11:00:00 -0700 This way the month is correct. We can see the effect of DST on the result. Doing all calculations in UTC avoids DST problems. $ for i in 1 2 3 4 5 6 7 8; do date -u -R --date="2012-08-15 12:00 +0000 $i months ago";done Sun, 15 Jul 2012 12:00:00 +0000 Fri, 15 Jun 2012 12:00:00 +0000 Tue, 15 May 2012 12:00:00 +0000 Sun, 15 Apr 2012 12:00:00 +0000 Thu, 15 Mar 2012 12:00:00 +0000 Wed, 15 Feb 2012 12:00:00 +0000 Sun, 15 Jan 2012 12:00:00 +0000 Thu, 15 Dec 2011 12:00:00 +0000 Now if you are really looking to see what calendar date it would be one month ago on the calendar then you need to supply an improved definition of what one month means. Is it four weeks with a week being exactly seven days? That can skip over months. Is it 30 days previously? That can skip over months. Is it the relative position from the first of the month such as the first Monday? Would 2012-07-31 minus one month be 2012-06-31? There isn't any definition that makes sense in every case because months are not consistent value items. They vary in size. For a calculation such as this you would need to program in what you would want with additional code that met your needs. Hope this helps, Bob From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 31 14:01:50 2012 Received: (at control) by debbugs.gnu.org; 31 Aug 2012 18:01:50 +0000 Received: from localhost ([127.0.0.1]:59810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VXR-0008Qa-Qb for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:01:50 -0400 Received: from joseki.proulx.com ([216.17.153.58]:50844) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VXP-0008QT-Ui for control@debbugs.gnu.org; Fri, 31 Aug 2012 14:01:48 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 08F84211D9 for ; Fri, 31 Aug 2012 12:00:31 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id EBFA72DC66; Fri, 31 Aug 2012 12:00:30 -0600 (MDT) Date: Fri, 31 Aug 2012 12:00:30 -0600 From: Bob Proulx To: control@debbugs.gnu.org Subject: tag not a bug Message-ID: <20120831180030.GC32661@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) tag 12318 + notabug moreinfo thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 31 14:20:14 2012 Received: (at control) by debbugs.gnu.org; 31 Aug 2012 18:20:14 +0000 Received: from localhost ([127.0.0.1]:59820 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VpC-0001EG-No for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:20:12 -0400 Received: from joseki.proulx.com ([216.17.153.58]:50917) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7VpA-0001E9-Kf for control@debbugs.gnu.org; Fri, 31 Aug 2012 14:20:09 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 76603211D9; Fri, 31 Aug 2012 12:18:51 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 5AB542DC66; Fri, 31 Aug 2012 12:18:51 -0600 (MDT) Date: Fri, 31 Aug 2012 12:18:51 -0600 From: Bob Proulx To: John Mizell Subject: Re: bug#12318: gnu date has incorrect date when using date math during a leap year Message-ID: <20120831181851.GA16365@hysteria.proulx.com> References: <20120831175952.GB32661@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: control Cc: Paul Wheelwright X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) tag 12318 - moreinfo close 12318 thanks John Mizell wrote: > Thanks Bob that really helps. I will adjust the syntax to calculate > the date correctly. Glad to help. In that case I will go ahead and mark the ticket as resolved. If you want to add more to the bug that is fine. If you wish general discussion that doesn't go to the bug tracker the mailing list coreutils@gnu.org is available. Bob From unknown Wed Sep 24 08:26:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12318: gnu date has incorrect date when using date math during a leap year In-Reply-To: Resent-From: SciFi Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 31 Aug 2012 18:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12318 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 12318@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13464385159961 (code B ref -1); Fri, 31 Aug 2012 18:42:01 +0000 Received: (at submit) by debbugs.gnu.org; 31 Aug 2012 18:41:55 +0000 Received: from localhost ([127.0.0.1]:59849 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7WAE-0002ab-J6 for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:41:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:50905) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7WAA-0002aR-A1 for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:41:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7W8t-0001LZ-Et for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:40:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:33615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7W8t-0001LV-By for submit@debbugs.gnu.org; Fri, 31 Aug 2012 14:40:31 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7W8s-0004uS-Bq for bug-coreutils@gnu.org; Fri, 31 Aug 2012 14:40:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7W8r-0001KW-9Q for bug-coreutils@gnu.org; Fri, 31 Aug 2012 14:40:30 -0400 Received: from plane.gmane.org ([80.91.229.3]:60869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7W8r-0001Ib-2U for bug-coreutils@gnu.org; Fri, 31 Aug 2012 14:40:29 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T7W8m-0008HQ-QC for bug-coreutils@gnu.org; Fri, 31 Aug 2012 20:40:24 +0200 Received: from ip68-12-81-221.ok.ok.cox.net ([68.12.81.221]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Aug 2012 20:40:24 +0200 Received: from sci-fi by ip68-12-81-221.ok.ok.cox.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Aug 2012 20:40:24 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: SciFi Date: Fri, 31 Aug 2012 18:40:10 +0000 (UTC) Lines: 38 Message-ID: References: <20120831175952.GB32661@hysteria.proulx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip68-12-81-221.ok.ok.cox.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUAAACSc2H60mcBAASuaS0jHh6BTSvzqGb63ZTInWgBDwpVHxReQjZeWVrAgFdpPxgGjZxOAAACEUlEQVQ4jdWSP4jTUBzHH4QssQU7XECkFbK8jm/RQV2EEASlzQ3nUFuOA31L9QJZXrNkyHJx1KUWIXRx86A33IHkJHVIhruEXpC7qctB6NElIHgRbKXm/HN5enEV/I2/z/t+f7/f+/0A+L/i5vU+ygX7u36DQcxF8GqxCHZzFafe4qubA27ZGOPREkCAA4B2ZG2sJFjZRpwcNhogawQFibL1Hr87DGzf9seUpOUpA3a813ISjGfBynmeAT4+BMybh4lYE6VZQEkKXvvMUKzFViTNZKqBEA9ZD9fiKbGi+rac1W/tlNlUQAiBVvRkSFVprvmPTvQTQjrPYoketnit/YlAogqCqUenv4qklqjIOy+qMAXChvX0A90YX/9cNWAKiHZfpgC6IS46pkEMAWqTIQXAA5F/a5qCKkA9GtCL8+L43l3ThCrUoiVa4V2x4qSamhFtskeDZoXok9TMSIHLgGwzl9a7RL+amm3o0pz6FFBc66owbr9My0jJF+of+95UNfRjp2OQ49X2wTlBoFDpVg19stPVH7N8SG24UJoSE0b11TtD9ujjZWr2YL1HVC1qt2S0qZSyKgw4qvR65DmvuAAlc0Q19jqsxHGpzGN37Ci/3ebtwA9cboyVsoMvHC1CnKOc3dFBlmPAjya50gjj/cHPMWhRwR/N7a0/vb4/C/3Zcg4AiGuGfh5IY6X/F/Bv4hsUadWnlRLxowAAAABJRU5ErkJggg== X-Face: '0779b&K9dHFY&RE]pe+6G"K#H0bKsv=*v; xP)lWn{j{Q:N#TW8to'Hasf~|/JVGTCD3-w"udO)tDY2FTMLT?]:|lG}~iOdd}9OzFhAtFi[.uUD7QZo>|`]ol List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I am just a passerby here. But when I see these specific kinds of "errors", especially due to "month" usages, I always have a thought: How would we make GNU-date to operate on the Month Number Itself when we type "month" in the --date string, and stop its assumption that we mean "30 days" by this usage? We would not need to do this fooling-around with the Day-15 trick as shown. I think this is where the "misusage" is being done by us plain-ol' folk. ;) I hope I've expressed correctly what I mean with this thought. (And I know: "Patches welcome." ) Thanks for letting me interject my thought on this. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQQQP3AAoJEKkeWNKet7+KvpgH/RrOXg+DPYVvydJvWLPQy+Mr 7qcdBhtZhyqr++miO2s96231fbxy0r3T3QMMqmHqvzmJnmfkimNce0ax2AuKRh1s RUS0mWzHE3qmdJQn8kataAdgK8tDjqawLCF9vxM4F4vjNyjBYSqDvLjr5zVYI1GV uTBmwpRfPfi0GlsBd5sLW+HC1ipfkqr6zOEWT4R9XrvGNLcyKeWCX2ShKMLxGMiF pgHJN+60mG18PpF/hF2GkPcnSpOWL2le+E9Jdw+UnzpIf5BkKN5DK3l4NHNKndW/ TeLqQoQvC+Aa4HxVK3VPLIS6egS4ttjP6By7WCisbxELbmaYD60SFMJrujZKRxo= =/bjb -----END PGP SIGNATURE----- -- From unknown Wed Sep 24 08:26:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12318: gnu date has incorrect date when using date math during a leap year Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 31 Aug 2012 20:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12318 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 12318@debbugs.gnu.org Cc: John Mizell Received: via spool by 12318-submit@debbugs.gnu.org id=B12318.134644463519665 (code B ref 12318); Fri, 31 Aug 2012 20:24:01 +0000 Received: (at 12318) by debbugs.gnu.org; 31 Aug 2012 20:23:55 +0000 Received: from localhost ([127.0.0.1]:60075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7Xkw-000578-Pc for submit@debbugs.gnu.org; Fri, 31 Aug 2012 16:23:55 -0400 Received: from joseki.proulx.com ([216.17.153.58]:51473) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7Xkt-00056z-Q9 for 12318@debbugs.gnu.org; Fri, 31 Aug 2012 16:23:53 -0400 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id BDCE3211D9; Fri, 31 Aug 2012 14:22:33 -0600 (MDT) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 530252DC66; Fri, 31 Aug 2012 14:22:33 -0600 (MDT) Date: Fri, 31 Aug 2012 14:22:33 -0600 From: Bob Proulx Message-ID: <20120831202232.GA9565@hysteria.proulx.com> References: <20120831175952.GB32661@hysteria.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) SciFi wrote: > I am just a passerby here. But when I see these specific > kinds of "errors", especially due to "month" usages, I always > have a thought: How would we make GNU-date to operate on the > Month Number Itself when we type "month" in the --date string, > and stop its assumption that we mean "30 days" by this usage? > We would not need to do this fooling-around with the Day-15 > trick as shown. I understand the sentiment. My personal one is that the "human" language relative date code wasn't very well thought out and should not have been released in the present form. I also believe that behavior change in long standing code is to be avoided since it breaks so many things. However this one is trouble to use correctly though so I think changing it couldn't hurt too much. > I think this is where the "misusage" is being done by us > plain-ol' folk. ;) I think you are suggesting 2012-08-31 -1 month would end up with 2012-07-31, right? Makes sense to me. Hard to argue with it. Right up until 2012-08-31 -2 months comes along. Is that 2012-06-31? Or 2012-06-30 by force of will? Or 2012-07-01 by math? Or throw it as an invalid date? (Which I think would be less friendly.) Or? :-) It isn't a simple problem. It would be great if there were some really smart artificially intelligent program to process it. It would have to smarter than a human because even humans can't agree on this. > I hope I've expressed correctly what I mean with this thought. > (And I know: "Patches welcome." ) > Thanks for letting me interject my thought on this. I think it was a very good comment. Bob From unknown Wed Sep 24 08:26:32 2025 X-Loop: help-debbugs@gnu.org Subject: bug#12318: gnu date has incorrect date when using date math during a leap year In-Reply-To: Resent-From: SciFi Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 31 Aug 2012 22:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12318 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 12318@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.134645090528709 (code B ref -1); Fri, 31 Aug 2012 22:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 31 Aug 2012 22:08:25 +0000 Received: from localhost ([127.0.0.1]:60130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7ZO5-0007Sz-Cl for submit@debbugs.gnu.org; Fri, 31 Aug 2012 18:08:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57449) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T7ZO3-0007St-Fe for submit@debbugs.gnu.org; Fri, 31 Aug 2012 18:08:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7ZMm-0007zd-NI for submit@debbugs.gnu.org; Fri, 31 Aug 2012 18:07:05 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:41782) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZMm-0007zZ-K1 for submit@debbugs.gnu.org; Fri, 31 Aug 2012 18:07:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZMl-0007LQ-HX for bug-coreutils@gnu.org; Fri, 31 Aug 2012 18:07:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T7ZMk-0007zM-29 for bug-coreutils@gnu.org; Fri, 31 Aug 2012 18:07:03 -0400 Received: from plane.gmane.org ([80.91.229.3]:59467) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T7ZMj-0007zI-Rq for bug-coreutils@gnu.org; Fri, 31 Aug 2012 18:07:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1T7ZMk-0002Gv-Iw for bug-coreutils@gnu.org; Sat, 01 Sep 2012 00:07:02 +0200 Received: from ip68-12-81-221.ok.ok.cox.net ([68.12.81.221]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Sep 2012 00:07:02 +0200 Received: from sci-fi by ip68-12-81-221.ok.ok.cox.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 01 Sep 2012 00:07:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ From: SciFi Date: Fri, 31 Aug 2012 22:06:50 +0000 (UTC) Lines: 49 Message-ID: References: <20120831175952.GB32661@hysteria.proulx.com> <20120831202232.GA9565@hysteria.proulx.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip68-12-81-221.ok.ok.cox.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAMFBMVEUAAACSc2H60mcBAASuaS0jHh6BTSvzqGb63ZTInWgBDwpVHxReQjZeWVrAgFdpPxgGjZxOAAACEUlEQVQ4jdWSP4jTUBzHH4QssQU7XECkFbK8jm/RQV2EEASlzQ3nUFuOA31L9QJZXrNkyHJx1KUWIXRx86A33IHkJHVIhruEXpC7qctB6NElIHgRbKXm/HN5enEV/I2/z/t+f7/f+/0A+L/i5vU+ygX7u36DQcxF8GqxCHZzFafe4qubA27ZGOPREkCAA4B2ZG2sJFjZRpwcNhogawQFibL1Hr87DGzf9seUpOUpA3a813ISjGfBynmeAT4+BMybh4lYE6VZQEkKXvvMUKzFViTNZKqBEA9ZD9fiKbGi+rac1W/tlNlUQAiBVvRkSFVprvmPTvQTQjrPYoketnit/YlAogqCqUenv4qklqjIOy+qMAXChvX0A90YX/9cNWAKiHZfpgC6IS46pkEMAWqTIQXAA5F/a5qCKkA9GtCL8+L43l3ThCrUoiVa4V2x4qSamhFtskeDZoXok9TMSIHLgGwzl9a7RL+amm3o0pz6FFBc66owbr9My0jJF+of+95UNfRjp2OQ49X2wTlBoFDpVg19stPVH7N8SG24UJoSE0b11TtD9ujjZWr2YL1HVC1qt2S0qZSyKgw4qvR65DmvuAAlc0Q19jqsxHGpzGN37Ci/3ebtwA9cboyVsoMvHC1CnKOc3dFBlmPAjya50gjj/cHPMWhRwR/N7a0/vb4/C/3Zcg4AiGuGfh5IY6X/F/Bv4hsUadWnlRLxowAAAABJRU5ErkJggg== X-Face: '0779b&K9dHFY&RE]pe+6G"K#H0bKsv=*v; xP)lWn{j{Q:N#TW8to'Hasf~|/JVGTCD3-w"udO)tDY2FTMLT?]:|lG}~iOdd}9OzFhAtFi[.uUD7QZo>|`]ol List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi again, Thank you for discussing this. On further thought… It seems that the "day" again is being "inserted" into this situation, "ruining" the "proper answer". I can see the automatic assumption of assigning "Day=Today" in the present logic. Again I would suggest a new option such as - --no-assumptions or --pedantic to tell it *not* to make [such] assumptions when that "piece" is not part of the "picture". Let me explain: The o.p. (Mr Mizell) shows several lines with only the month and year to be presented. No "day" at all. The "A.I." implied would be rather simple: it's begging to say "I don't care about the Day, just deal with the Month [and Year] in this equation." By having just-this-much logic in GNU-date could perhaps alleviate many of these type problems without breaking so-many historical things while simultaneously providing "correct" answers [hopefully finally]. Still without having to use the Day-15 trick of course. ;) (…yeah, I still wouldn't know how to code this, alas…) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (Darwin) Comment: GPGTools - http://gpgtools.org iQEcBAEBAgAGBQJQQTRcAAoJEKkeWNKet7+K0d0H/0krWsNTmggUcDVtRrbGR6eg h+7Czuo8O4oi+awujB8qj5VOVpXEc9aMlO83MuExgFchCgSeRMxkh9K9W2TIhSxZ f43rhYpSoebGcz652vItmNCCSo0A24WSpqcVlZzCj1hWOJYXlMNVRPAIFmB2zvmh JJ5Z1kSkHKuvuvqUhTz47K4oHSNnua1K8vLg98OK/F+FPEUzi0mfL7t743PCX9QT PhZdkhAyl6pmcl3RJNDuK+Kt4HLshG2+W/YPisDlrlu8t0v1uuolwmDTeOMO6PuF a/hUrlF8V2pGPqm/fYFQf02sxDawjZQqnBjLpOc10KdBp16kh73Nlq38mRExurU= =jefA -----END PGP SIGNATURE----- --