Giter Club home page Giter Club logo

Comments (5)

dr-prodigy avatar dr-prodigy commented on June 29, 2024

Hi,
in fact, this seems related to the change of hebrew.to_jd_gregorianyear signature. I'm currently looking for a fix on python-holidays for this new behaviour.
open issue
Although a subsequent call to gregorian.from_jd as gregorian.from_jd(hebrew.to_jd_gregorianyear (..))
seems to me the easiest way to revert to the previously returned format (year, month, day) I noticed some differences (possibly issues?) in the date calculation results (ie: current results don't match the existing unit test expectations) so I'm currently in standby, keeping back convertdate to v2.2.0.

Any update available on this?

from convertdate.

dr-prodigy avatar dr-prodigy commented on June 29, 2024

Hi, any updates / thoughts on this @fitnr ? Thx

from convertdate.

fitnr avatar fitnr commented on June 29, 2024

Please post the smallest possible code snippet to reproduce the error. I can’t make head or tails of what’s in the original comment

from convertdate.

dorgol avatar dorgol commented on June 29, 2024

I reversed the code to an older version:

def to_jd_gregorianyear(gregorianyear, hebrew_month, hebrew_day):
      for y in (gregorianyear + HEBREW_YEAR_OFFSET, gregorianyear + HEBREW_YEAR_OFFSET + 1):
          jd = to_jd(y, hebrew_month, hebrew_day)
          gd = gregorian.from_jd(jd)
          if gd[0] == gregorianyear:
              break
          else:
              gd = None

    if not gd:  # should never occur, but just incase...
        raise ValueError("Could not determine gregorian year")

    # tuple: (y, m, d)
    return (gd[0], gd[1], gd[2])

instead of:

def to_jd_gregorianyear(gregorianyear, hebrew_month, hebrew_day):
    
    for y in (gregorianyear + HEBREW_YEAR_OFFSET, gregorianyear + HEBREW_YEAR_OFFSET + 1):
        jd = to_jd(y, hebrew_month, hebrew_day)
        gd = gregorian.from_jd(jd)
        if gd[0] == gregorianyear:
            break

        jd = None

    if not jd:  # should never occur, but just incase...
        raise ValueError("Could not determine gregorian year")

    return gregorian.to_jd(gd[0], gd[1], gd[2])

The problem is that gregorian.to_jd returns a number instead of a tuple.

from convertdate.

fitnr avatar fitnr commented on June 29, 2024

Yes, this method changed. The earlier version didn't adequately support other functions, especially the holiday library.

from convertdate.

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.