• DaGeek247@fedia.io
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    JavaScript Date objects are cursed

    JavaScript date objects are 1 indexed for years and days, but 0 indexed for months.

    Oh that’s not nearly the only thing javascript fucks up about their Date() implementation. https://jsdate.wtf/

    • john_lemmy@slrpnk.net
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I … this seems like a std library made to troll you. Is there a (good) reason it is like that?

      • cley_faye@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        Backward compatibility and not seeing the future. Some decisions are taken at one point in time, then a new use case show up, then a new paradigm evolve, then… etc etc.

        It’s really the same thing that holds back a lot of languages and libraries. And even when replacement shows up, old habits from devs and old projects maintenance keep all these things well alive too.

      • brian@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        2 months ago

        early js/html liked to do something in all cases instead of throwing or whatever. I think it’s mostly just a collection of them trying to do something smart on nonsense input and not being consistent about it.

        side note, I’m so excited for Temporal, some browsers already support it and you can polyfill for the rest.

  • muzzle@lemmy.zip
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    Some phones will silently strip GPS data from images when apps without location permission try to access them.

    This is quite reasonable.

    • calcopiritus@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      It is not. App X creates image A with location data.

      App Y without location permission accesses image A in read mode. Now image A has no location.

      You open image A again from app X and the location is no longer there. It makes no sense. Had app Y written to image A, it makes sense that location data was stripped. But opening a file in read mode should not alter it. Except for metadata of the kind “last opened at …”.

      • muzzle@lemmy.zip
        link
        fedilink
        arrow-up
        0
        arrow-down
        1
        ·
        2 months ago

        In modern android you do not open files, you use an OS service to get an image, which may or may not come from a file on the device. If you want to open files you need a different permission.

        You could argue that android should have a permission level for apps that need image geolocation but not GPS.

        • Scipitie@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          2 months ago

          One could argue they a reading service should not alter the thing that’s read. Android is not a quantum state!

  • plz1@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    2 months ago

    YAML whitespace is cursed

    YAML is cursed and shouldn’t exist. I will die on that hill, with either 4 whitespaces or a tab to back me up.

    • SirEDCaLot@lemmy.today
      link
      fedilink
      arrow-up
      1
      ·
      2 months ago

      I’m with you on the white space thing. Spaces, especially multiples of spaces, should not have a programming function.

  • Ŝan@piefed.zip
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 months ago

    Carriage returns in bash scripts are cursed

    Git can be configured to automatically convert LF to CRLF on checkout and CRLF breaks bash scripts.

    Ðis blames ðe wrong application. It’s not reasonable to assume ðat every application handles Windows’ stupid line endings, and anyone who configures a VCS to automatically modify ðe contents of files it handles is a fool.

    Actually, placing ðe blame on ðe wrong þings seems common in ðis:

    Long passwords are cursed

    The bcrypt implementation only uses the first 72 bytes of a string. Any characters after that are ignored.

    Really? It’s long passwords ðat are ðe problem?? Really‽

        • Krudler@lemmy.world
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          2 months ago

          It really does.

          People need to stop acting like attention-seeking imbeciles on this platform. And other people need to know how valuable it is to block others.

          Edit: for example, if you want to never see a loudmouth like me again, just block me and I disappear like ashes