Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-11-15 13:18:57


 
> 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