Giter VIP home page Giter VIP logo

Comments (3)

milancurcic avatar milancurcic commented on July 23, 2024

Hi Chris, thanks for submitting this issue. I just noticed this now, I should probably turn on e-mail notifications. Will look into it and let you know what I find. Thanks.

from datetime-fortran.

milancurcic avatar milancurcic commented on July 23, 2024

Hi Chris, I was able to reproduce your bug. Note that the time change was also incorrect for December, indicating that datetime+timedelta(hours=-6) was misbehaving whenever daysInMonth(datetime%month - 1,datetime%year) < 31. The bug is fixed by changing the subroutine addDays from this:

    ELSEIF(self%day < 1)THEN
      self%day = self%day+daysInCurrentMonth
      self%month = self%month-1

to:

    ELSEIF(self%day < 1)THEN
      self%month = self%month-1
      self%day = self%day+daysInMonth(self%month,self%year)

The problem was occuring because switching into a previous month caused the day component to update using an old value of daysInCurrentMonth.

The output of your program is now:

 2013-01-01T00:00:00.000 -6hrs = 2012-11-30T18:00:00.000
 2013-02-01T00:00:00.000 -6hrs = 2013-01-31T18:00:00.000
 2013-03-01T00:00:00.000 -6hrs = 2013-02-28T18:00:00.000
 2013-04-01T00:00:00.000 -6hrs = 2013-03-31T18:00:00.000
 2013-05-01T00:00:00.000 -6hrs = 2013-04-30T18:00:00.000
 2013-06-01T00:00:00.000 -6hrs = 2013-05-31T18:00:00.000
 2013-07-01T00:00:00.000 -6hrs = 2013-06-30T18:00:00.000
 2013-08-01T00:00:00.000 -6hrs = 2013-07-31T18:00:00.000
 2013-09-01T00:00:00.000 -6hrs = 2013-08-31T18:00:00.000
 2013-10-01T00:00:00.000 -6hrs = 2013-09-30T18:00:00.000
 2013-11-01T00:00:00.000 -6hrs = 2013-10-31T18:00:00.000
 2013-12-01T00:00:00.000 -6hrs = 2013-11-30T18:00:00.000

This fix has been commited to the master repo.

Thank you for improving datetime-fortran.

from datetime-fortran.

chrisbunney avatar chrisbunney commented on July 23, 2024

Thanks for fixing this, Milan.
It's a really useful library!
All the best,
Chris.

On 5 February 2014 18:48, Milan Curcic [email protected] wrote:

Closed #6 #6.

Reply to this email directly or view it on GitHubhttps://github.com//issues/6
.

from datetime-fortran.

Related Issues (20)

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.