|
Boost Users : |
From: shaneforbes (shaneforbes_at_[hidden])
Date: 2002-11-15 17:56:35
Thanks for the reply.
Yes it makes MUCH more sense not allowing invalid dates in the first
place.
BTW the same problem seems to happen with dates such as 20020431,
20040230 and so on - if day at end of month is less than 31 it looks
like it is being accepted and wrapped to the next month...
Hate to ask this but here goes! When will the fixed version be
available? I don't mean to be rude, just enquiring!
Thanks again!
--- In Boost-Users_at_y..., "Jeff Garland" <jeff_at_c...> wrote:
>
>
>
> > date bogus_date_I_hope(2002,02,29);
> >
> > I was hoping the above date would not be allowed (2002 is not a
leap
> > year).
> >
> > However I notice that the date_time library considers this to be
Mar
> > 01, 2002.
>
> Right, this isn't good.
>
> > This is reasonable but what if I want the stricter
interpretation -
> > i.e, "20020229 is not a valid date".
> >
> > After all the date_time library does not allow 20020232 and a not
too
> > unreasonable person might say "Well if 2002029 is converted to
> > 20020301 why isn't 20020232 converted to 20020304."
> >
> > Short of creating my own logic is there a way for the date_time
> > library to not accept invalid dates?
>
> Yes. I consider allowing this invalid date a bug which will
> be fixed.
>
> > I was hoping is_not_a_date() would not allow 20020229.
>
> My preference is to prevent construction of 20020229 and thus
> the only way to get is_not_a_date true is to construct the date
> explicitly not_a_date_time.
>
> Jeff
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net