• Hanzito (unregistered)

    Even weirder is that it then converts it back to a Date object.

  • Zatapatique (unregistered)

    JavaScript does have a method to truncate to just the date part:

    event.setHours(0, 0, 0, 0);
    
  • (nodebb)

    Date object in Javascript is atrocious. I'm about ready to start using a custom type.

  • (nodebb) in reply to Mr. TA

    I'm about ready to start using a custom type.

    That would be incredibly stupid. In fact, the only course of action I can think of which would be more stupid would be to use the Date object in Javascript.

  • Rob (unregistered)

    That would be incredibly stupid.

    You'd think that's always the case, but sometimes it's necessary. Joda-Time was created to overcome the issues with Java's Date and Calendar classes. It was later used as basis for the new Java time classes in Java 8. Without Joda-Time I'm not sure we would have gotten the new Java time classes.

  • (nodebb)

    JavaScript has a bunch of third-party datetime libraries. Moment.js is probably the most popular, but its development has been discontinued and they're recommending others.

  • Someone (unregistered) in reply to dpm

    I concur. Let's see how everyone does on https://jsdate.wtf/

  • Deeseearr (unregistered)

    You can't just throw that information away.

    As legions of programmers have demonstrated, you can throw that information away. First you have to accept that time is an illusion and lunchtime doubly so.

  • Oddly Shaped Human (unregistered)

    It's not here yet, but the Temporal object is coming to JavaScript. This will address most of the existing problems with the original Date object. And introduce new ones, I'm sure. But there's hope on the horizon.

  • Anonymous') OR 1=1; DROP TABLE wtf; -- (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to Someone

    Let's see how everyone does on https://jsdate.wtf/

    "I scored 10/28 on https://jsdate.wtf and all I got was this lousy text to share on social media."

    I bow in your general direction for spreading such a delicious demonstration of evil.

Leave a comment on “In the Zone”

Log In or post as a guest

Replying to comment #687421:

« Return to Article