Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Near end-of-time dates/datetimes have odd Day values #113

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 7 comments
Closed

Near end-of-time dates/datetimes have odd Day values #113

GoogleCodeExporter opened this issue Mar 15, 2015 · 7 comments
Labels
Milestone

Comments

@GoogleCodeExporter
Copy link

        LocalDateTime local = Instant.MaxValue.InZone(DateTimeZone.Utc).LocalDateTime;
        Console.WriteLine(local);
        Console.WriteLine(local.Date);

Expected: anything sane, really.

Actual:
01/01/31197 02:48:05
288 December 31196

The first value seems reasonable, but the 288th of December, not so much...

I'm not sure whether we really need to fix this before V1, but definitely at 
some point.

Original issue reported on code.google.com by jonathan.skeet on 5 Sep 2012 at 8:30

@GoogleCodeExporter
Copy link
Author

Interestingly enough, using Int64.MaxValue - 1 as the number of ticks gives:

288/12/31196 02:48:05
288 December 31196

Which is at least consistent (and seems to project back to sanity, i.e. 
31196-12-31).  This is also reproducible with ZonedDateTime too, of course.

I suspect that the underlying problem here is that GregorianCalendarSystem 
defines the maximum [complete] year as 31196, while these dates are in 
somewhere mid-October 31197.  I'm not quite sure why the remainder is spilling 
into the Day field rather than any other (nor why Int64.MaxValue is broken in a 
_different_ way).

Pretty sure we don't need this for 1.0 :-)

Original comment by malcolm.rowe on 20 Oct 2012 at 9:33

  • Changed title: Near end-of-time dates/datetimes have odd Day values
  • Added labels: Milestone-unscheduled

@GoogleCodeExporter
Copy link
Author

I think we need to accept that LocalDateTime (etc) values just don't work 
beyond the advertised year limit of the calendar - and stop them from being 
created. Each calendar can have a pair of LocalInstant values being the 
smallest and largest they'll handle, and every constructor for public types 
will need to check against those.

(Note that the maximum supported year is now slightly lower than it was, to 
make other code more sane.)

Original comment by jonathan.skeet on 18 Mar 2013 at 8:19

@GoogleCodeExporter
Copy link
Author

Address in 1.3, per issue 215?

Original comment by malcolm.rowe on 26 Jul 2013 at 10:04

@GoogleCodeExporter
Copy link
Author

At least try to, yes. (CalendarSystem now has MinTicks and MaxTicks - we just 
don't use them much.)

Original comment by jonathan.skeet on 26 Jul 2013 at 10:38

  • Added labels: Milestone-1.3-consider
  • Removed labels: Milestone-unscheduled

@GoogleCodeExporter
Copy link
Author

Original comment by malcolm.rowe on 30 May 2014 at 8:34

  • Added labels: Milestone-unscheduled
  • Removed labels: Milestone-1.3-consider

@GoogleCodeExporter
Copy link
Author

Fixed as part of 2.0. We have a smaller range (-9998 to 9999 ISO, inclusive) 
but we're pretty rigorous about supporting it properly.

Original comment by jonathan.skeet on 2 Aug 2014 at 8:01

  • Changed state: Fixed

@GoogleCodeExporter
Copy link
Author

Original comment by malcolm.rowe on 2 Aug 2014 at 8:46

  • Added labels: Milestone-2.0.0
  • Removed labels: Milestone-unscheduled

@malcolmr malcolmr added the bug label Mar 15, 2015
@malcolmr malcolmr modified the milestone: 2.0.0 Mar 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants