Giter VIP home page Giter VIP logo

Comments (4)

leroycep avatar leroycep commented on July 23, 2024

Ohhh, that is confusing. I would to happy to merge a pull request if you have the time.

from zig-tzif.

FObersteiner avatar FObersteiner commented on July 23, 2024

I've made a draft here: #6

Turns out this is some rabbit hole to go down... Before I can proceed with this, I'll have to get a clear understanding of your concept :)

  • The method PosixTZ.offset() - is it supposed to take Unix time in seconds and return the corresponding UTC offset of given time zone? Is that correct?
  • Same goes for TimeZone.localTimeFromUTC() I suppose? (--> Unix time + corresponding UTC offset)

from zig-tzif.

leroycep avatar leroycep commented on July 23, 2024
  • The method PosixTZ.offset() - is it supposed to take Unix time in seconds and return the corresponding UTC offset of given time zone? Is that correct?

Yep, that's correct. It takes a unix timestamp in seconds and returns what the UTC offset is at that time based on the rules around Daylight Saving Time.

  • Same goes for TimeZone.localTimeFromUTC() I suppose? (--> Unix time + corresponding UTC offset)

And this is also correct, if I understand what you're saying. It takes a Unix timestamp in UTC and converts it into a timestamp in the given timezone.

from zig-tzif.

FObersteiner avatar FObersteiner commented on July 23, 2024

right, I think the missing part was subtracting the offset, which you have now added here

            const start_dst = range.start.toSecs(utc_year) - this.std_offset;
            const end_dst = range.end.toSecs(utc_year) - this.dst_offset;

from zig-tzif.

Related Issues (6)

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.