I believe that the normalization going on is assuming that the date is
valid, but the pieces representing that date might individually be invalid.
Date validation is usually for building a valid date, but if you know the
date is valid (even if the parts aren't), then you can skip validating the
parts.

I'd love to be corrected by someone more knowledgeable.

On Tue, Oct 23, 2018 at 10:00 AM <taras...@gmail.com> wrote:

> Hi,
>
> I was surprised to find the following worked without any reported errors:
>
> t1 := time.Date(-1, 1, 10, 23, 0, 0, 0, time.UTC) // invalid year
> t2 := time.Date(2000, 13, 10, 23, 0, 0, 0, time.UTC) // invalid month
> m := time.Month(13) // invalid month
>
> What is the rationale in accepting invalid month/year values?
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to