GithubHelp home page GithubHelp logo

Comments (3)

jodastephen avatar jodastephen commented on May 28, 2024

August the 11th 2013 is not a Tuesday, its a Saturday. The code parses August the 11th, and then sets the day-of-week to be Tuesday, which is the 6th.

Not a bug I'm afraid.

from joda-time.

marccarre avatar marccarre commented on May 28, 2024

Thanks for your quick reply Stephen.
However, it still looks weird to me: wouldn't you typically expect one of the below results?

    1. an exception, since the date doesn't exist
    1. Sun Aug 11 21:41:19 2013 (day-of-month driving day-of-week, since the later one is "smaller"?)

Or, if a "lenient" parsing mode was available:

    1. Tue Aug 11 21:41:19 2013 even if this is a non-existing date

Thoughts?
Also, would you have a list of all similar conventions that Joda follows?

Cheers,

M.

from joda-time.

jodastephen avatar jodastephen commented on May 28, 2024

Joda-Time's parsing is essentially simple. It starts with the largest field and sets them one at a time on top of 1970-01-01. This is similar to the JDK, and it means that Joda does not "understand" the fact that it is erroneous. While it could be better, I don't plan to improve it. Essentially, any patch would probably be more about special casing, rather than a general fix.

JSR-310 handles cases like this much better, because it has a better architecture.

from joda-time.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.