| Summary: | date command does not take -v31d (31st day of month) option | ||
|---|---|---|---|
| Product: | Base System | Reporter: | paulchef <paulchef> |
| Component: | bin | Assignee: | freebsd-bugs (Nobody) <bugs> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
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 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. |
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 %