• call_me_xale@lemmy.zip
    link
    fedilink
    arrow-up
    81
    arrow-down
    1
    ·
    8 months ago

    Bold of you to assume no one will come up with a replacement date library rather than just getting rid of JS.

    • ARk
      link
      fedilink
      arrow-up
      5
      ·
      8 months ago

      reserve me tickets for the inevitable shit show that follows 🍿

  • EmergMemeHologram@startrek.website
    link
    fedilink
    arrow-up
    52
    arrow-down
    4
    ·
    edit-2
    8 months ago

    Partitioning by integer secobds is dumb.

    Just assign 0 to the start of time, 1 to the end of time, and every point between is represented by a double precision floating point number.

    For all those who believe time is infinite please apply a logistic transformation to your dates.

    • rekabis@lemmy.ca
      link
      fedilink
      arrow-up
      5
      ·
      8 months ago

      Fun fact: infinities can be different sizes, such that one infinity can be larger than another.

      They’re still infinities, with no end. Just of different absolute sizes. Fun stuff to rabbithole down into if you want to melt your brain on a lazy afternoon.

      • EmergMemeHologram@startrek.website
        link
        fedilink
        arrow-up
        4
        ·
        8 months ago

        My nephew refuses to talk to me because of this.

        He said I smelled like farts, then I said he did times 10, he replied times a hundred, I pulled out the infinity card, then he replied with times infinity plus one, activating my trap card. I sat him down and for 90 minutes, starting with binary finger counting and Cantor’s diagonalisation argument, I rigorously walked him through infinities and Aleph numbers (only the first 2 in detail, I’m not a monster).

        Now he knows the proper retort (not infinity plus one, use Aleph 1). Unfortunately now he’s not sure if numbers are “real” or not because I taught him that natural numbers are the cardinal numbers.

      • CanadaPlus@lemmy.sdf.org
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        8 months ago

        Even more fun: nobody can agree on how many there are (some people say none!), and mathematics is self-consistent regardless of if you assume certain ones definitely do or definitely don’t exist.

    • CanadaPlus@lemmy.sdf.org
      link
      fedilink
      arrow-up
      4
      ·
      edit-2
      8 months ago

      For all those who believe time is infinite please apply a logistic transformation to your dates.

      In what unit? They’re not scale invariant.

      Also in case you’re serious, I’m sure (by the pigeonhole principle) you’ll run out of exponents just about as fast as you would run out of integers.

      • EmergMemeHologram@startrek.website
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        8 months ago

        You can derive the date by first taking the largest unit, checking if it makes sense, then moving to a smaller time unit iteratively until the date comes out right.

    • interolivary@beehaw.org
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      8 months ago

      please apply a logistic transformation to your dates

      Which is definitely a totally normal and everyday operation that normal people do with dates

  • FiniteLooper
    link
    fedilink
    English
    arrow-up
    30
    arrow-down
    1
    ·
    8 months ago

    No programming language should last 200,000 years

  • viking@infosec.pub
    link
    fedilink
    arrow-up
    27
    arrow-down
    2
    ·
    8 months ago

    What people fail to see is that this is the largest date the API can store, not a magical cutoff date in the distant future.

    You could create a date today and send it to the API, and it could potentially crash it, or create a buffer overrun.

    • Redkey@programming.dev
      link
      fedilink
      arrow-up
      8
      ·
      8 months ago

      The definition of the Date object explicitly states that any attempt to set the internal timestamp to a value outside of the maximum range must result in it being set to “NaN”. If there’s an implementation out there that doesn’t do that, then the issue is with that implementation, not the standard.

  • Turun@feddit.de
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    8 months ago

    That’s because this is the maximum integer that can be stored in a double precision floating point number without loss of precision, lol

    • interolivary@beehaw.org
      link
      fedilink
      arrow-up
      7
      ·
      8 months ago

      That’s one thing that really bugs me about Javascript (weirdly enough I’m okay with eg prototypal inheritance and how this works, or at least worked before the bolted on classes that were added because apparently I’m like one of the dozen or so people who had no problems with those concepts). The fact that all numbers are floats can lead to a lot of fun and exciting bugs that people might not even realize are there until they suddenly get a weird decimal where they expected an integer

  • Alien Nathan Edward
    link
    fedilink
    arrow-up
    15
    ·
    8 months ago

    I’ve got a bunch of freeze dried food from my backpacking days. Who wants to jump in on a business selling Y275.76K Survival Kits?

      • 14th_cylon
        link
        fedilink
        arrow-up
        2
        ·
        8 months ago

        it may or may not be a monday - probably won’t. it will be monday based on the (4000 | year) => !(leap year) rule, but by the year 275000 the difference will be so big that i am pretty sure people will make more rules to solve that.