Giter VIP home page Giter VIP logo

Comments (5)

gazpachoking avatar gazpachoking commented on May 26, 2024 1

Oh, were you comparing some parsed date to another? That indeed isn't working at the moment if only one specified a timezone.

tasks:
  a_task:
    mock:
      - title: someentry
    set:
      somedate: "2023-12-31T00:00:00+03:00"
      otherdate: "2023-12-31"
      somecomparison: "{{somedate|parsedate < otherdate|parsedate}}"

from flexget.

gazpachoking avatar gazpachoking commented on May 26, 2024

Good catch. parsedate indeed needs to be updated to use the compatibility class that allows comparing naive to offset aware datetimes. That being said, utcnow and now should already have that feature so I would expect your example to work already. Are you on the latest version? (There were a couple other fixes after the initial merge.) If so, can you give some more details of you example so I can understand how both sides of the comparison somehow avoided getting our custom compatibility layer? Just want to make sure I'm fixing in all the places needed.

Here's the quick test I did which was already working.

tasks:
  a_task:
    mock:
      - title: someentry
    set:
      somedate: "2023-12-31"
      somecomparison: "{{somedate|parsedate < utcnow}}"

from flexget.

gazpachoking avatar gazpachoking commented on May 26, 2024

This commit will almost certainly fix your issue. I'd like to understand exactly the situation you were running in to though still to make sure all edge cases are captured.

from flexget.

jacaru avatar jacaru commented on May 26, 2024

This commit will almost certainly fix your issue. I'd like to understand exactly the situation you were running in to though still to make sure all edge cases are captured.

Yeah, I was comparing two parsedate's, one originated from the new utcnow and thus had timezone information, and the other didn't.

If I were to start from scratch then I would consider timezones for all dates but now I have to deal with the information that I have in the DB so the compat layer is welcome. Thanks!

from flexget.

gazpachoking avatar gazpachoking commented on May 26, 2024

Ahh, gotcha. Yep, this will fix your issue.

from flexget.

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.