new LocalDate(2020, 2, 30);

16 views
Skip to first unread message

Joe Moore

unread,
Jan 8, 2020, 5:03:12 PM1/8/20
to Noda Time
Am I missing something?  On my computer, the above statement returns Monday, January 1, 0001 when rendered with .ToString().  I downloaded from NuGet and my version lists as 2.4.7.0 .  According to the way I read the documentation at https://nodatime.org/2.2.x/api/NodaTime.LocalDate.html, I think it should throw ArgumentOutOfRangeException?

Thanks!!

Jon Skeet

unread,
Jan 8, 2020, 5:42:30 PM1/8/20
to Noda Time
Yup, that should throw an exception. Will check it in the morning (UK time).

On Wed, 8 Jan 2020, 22:03 Joe Moore, <joe.moo...@gmail.com> wrote:
Am I missing something?  On my computer, the above statement returns Monday, January 1, 0001 when rendered with .ToString().  I downloaded from NuGet and my version lists as 2.4.7.0 .  According to the way I read the documentation at https://nodatime.org/2.2.x/api/NodaTime.LocalDate.html, I think it should throw ArgumentOutOfRangeException?

Thanks!!

--

---
You received this message because you are subscribed to the Google Groups "Noda Time" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noda-time+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/noda-time/7bbcc1cd-61b9-43d8-bfbb-0757f7790bcb%40googlegroups.com.

Jon Skeet

unread,
Jan 9, 2020, 1:34:32 AM1/9/20
to Noda Time
I can't reproduce this. Here's an example which works as expected, throwing an exception:

using NodaTime;
using System;

class Program
{
    static void Main(string[] args)
    {
        var date = new LocalDate(2020, 2, 30);
        Console.WriteLine(date);
    }
}

Please could you try that on your system? Please file an issue at https://github.com/nodatime/nodatime/issues with the result - or if that throws as expected but you have a different minimal example that misbehaves, please post that (in the issue) instead.

Jon

Joe Moore

unread,
Jan 14, 2020, 6:06:39 PM1/14/20
to Noda Time
Sorry for the red herring.  What I was seeing was a misunderstanding of what this exception should look like in debugging and the fact that the class itself is left in a state that looks like it has MinDate in it.  Thanks so much for the immediate response!  In the future, if I see something which looks like an issue it will go in the right place.


On Thursday, January 9, 2020 at 12:34:32 AM UTC-6, Jon Skeet wrote:
I can't reproduce this. Here's an example which works as expected, throwing an exception:

using NodaTime;
using System;

class Program
{
    static void Main(string[] args)
    {
        var date = new LocalDate(2020, 2, 30);
        Console.WriteLine(date);
    }
}

Please could you try that on your system? Please file an issue at https://github.com/nodatime/nodatime/issues with the result - or if that throws as expected but you have a different minimal example that misbehaves, please post that (in the issue) instead.

Jon


On Wed, 8 Jan 2020 at 22:42, Jon Skeet <sk...@pobox.com> wrote:
Yup, that should throw an exception. Will check it in the morning (UK time).

On Wed, 8 Jan 2020, 22:03 Joe Moore, <joe.mo...@gmail.com> wrote:
Am I missing something?  On my computer, the above statement returns Monday, January 1, 0001 when rendered with .ToString().  I downloaded from NuGet and my version lists as 2.4.7.0 .  According to the way I read the documentation at https://nodatime.org/2.2.x/api/NodaTime.LocalDate.html, I think it should throw ArgumentOutOfRangeException?

Thanks!!

--

---
You received this message because you are subscribed to the Google Groups "Noda Time" group.
To unsubscribe from this group and stop receiving emails from it, send an email to noda...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages