From nobody@FreeBSD.org  Thu Apr 27 03:52:17 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 0C27137B5F8
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 27 Apr 2000 03:52:17 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id DAA69496;
	Thu, 27 Apr 2000 03:52:16 -0700 (PDT)
	(envelope-from nobody@FreeBSD.org)
Message-Id: <200004271052.DAA69496@freefall.freebsd.org>
Date: Thu, 27 Apr 2000 03:52:16 -0700 (PDT)
From: paulchef@starwon.com.au
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: date command does not take -v31d (31st day of month) option
X-Send-Pr-Version: www-1.0

>Number:         18253
>Category:       bin
>Synopsis:       date command does not take -v31d (31st day of month) option
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 27 04:00:01 PDT 2000
>Closed-Date:    Tue May 9 03:43:02 PDT 2000
>Last-Modified:  Tue May 09 03:46:35 PDT 2000
>Originator:     Paul Cheffers
>Release:        2.2.7
>Organization:
Starwon Internet
>Environment:
heimdall % uname -a
FreeBSD heimdall.starwon.com.au 2.2.7-RELEASE FreeBSD 2.2.7-RELEASE #0: Fri Feb
 5 12:07:22 WST 1999     ianc@heimdall.starwon.com.au:/usr/src/sys/compile/HEIMD
ALL  i386
heimdall %
>Description:
heimdall % date -v31d -v1m -v1999y
31d: Cannot apply date adjustment
usage: date [-nu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHM]] ...
            [-f fmt date | [[[[yy]mm]dd]HH]MM[.ss]] [+format]
heimdall %
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:

From: Anatoly Vorobey <mellon@pobox.com>
To: paulchef@starwon.com.au
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/18253: date command does not take -v31d (31st day of month) option
Date: Thu, 27 Apr 2000 14:25:25 +0000

 On Thu, Apr 27, 2000 at 03:52:16AM -0700, paulchef@starwon.com.au wrote:
 > heimdall % date -v31d -v1m -v1999y
 > 31d: Cannot apply date adjustment
 
 date -v1m -v31d -v1999y 
 
 will work. This is because the day value is checked for validity against
 the current month, which has not yet been changed to January.
 
 I don't know that this is a bug. If fixing it is desirable, walking
 the 'vary' structure in vary_apply() in src/bin/date/vary.c needs to
 be changed to first apply year adjustments, then month adjustments, etc.
 and not in the order of command line arguments.
 
 -- 
 Anatoly Vorobey,
 mellon@pobox.com http://pobox.com/~mellon/
 "Angels can fly because they take themselves lightly" - G.K.Chesterton
 
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Tue May 9 03:43:02 PDT 2000 
State-Changed-Why:  
It's vital that the -v options are processed in order, otherwise it is 
impossible to do something like ``date -v3m -v-1d'' to find out the last 
day in February.  The man page explicitly says 

The date can be adjusted as many times as required using these 
flags.  Flags are processed in the order given. 
>Unformatted:
