Code Monkey home page Code Monkey logo

geotools's People

Contributors

skial avatar waneck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geotools's Issues

Syntactic sugar

Hey Cauê,

Great work on this little gem!

I'm curious - would some macro magic allow Minutes(12) to be written as 12.minutes for example?

incorrect TzDate.timezone()

I've just discovered that TzDate.timezone() may return incorrect values due to historical timezone changes.
For example I was testing with Kiribati timezone. And at 01.01.1970 there was different offset then it is now.
Your implementation returns -10:40 hours. Buy todays timezone offset there is +14. Which can be calculated correctly in haxe (but not on all platforms due to makeUtc function):

    var d: Date = Date.fromTime(Math.ffloor(Date.now().getTime() / 1000) * 1000); //note ffloor (not floor) to avoid integer overflow
    var utcD: Float = DateTools.makeUtc(d.getFullYear(), d.getMonth(), d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds());
    var tzOffset: Float = utcD - d.getTime();

TzDate.timezone() doesn't work on Neko

I have not tested for other platforms, but on Neko, calling TzDate.timezone() throws error:
Error : std@date_set_hour

seems that problem is in second argument passed to constructor - it denotes month, and it can't be 0
return - (new Date(1970,00,01 , 00,00,00).getTime() / 1000)
should be:
return - (new Date(1970,01,01 , 00,00,00).getTime() / 1000)

But then, it returns nonsensical value: -2656800

On my computer, I have set timezone UTC +06:00, so it should return -360 minutes, or in seconds it would be -21600.

In the end, I was able to get my desired timezone value from this code:
var a = DateTools.format(Date.fromTime(0), '%H:%M').split(':');
var offset = -Std.parseInt(a[0]) * 60 + Std.parseInt(a[1]);
trace(offset);

  • it calculates minutes, but can be extended to include seconds also.

edit: on PHP works TzDate.timezone(). Problem is in Neko.

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.