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

    To be fair, returning the actual timezone (as defined by tz.db) is useful if you don’t just want the current time since you’ll be able to take DST into account. Not sure how Vienna is -8 though, it should be +1 (or 2 depending on DST).

    • carrylex@lemmy.worldOP
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      4 months ago

      Just for further clarification, the API works like this:

      • time is the local (client) time (in this case UTC-7)
      • servertimezone is the time zone where the server is located
      • timezoneoffset is the offset of the local time relative to the servertimezone (offset from the servers PoV)

      To get the UTC date you have to do something like this:

      time.minusHours(timezoneoffset).atZone(servertimezone).toUTC()