Giter Club home page Giter Club logo

Comments (6)

joshuacronemeyer avatar joshuacronemeyer commented on June 28, 2024 1

Thanks guys. The Timecop implementation of strptime is a work in progress. Our implementation is incomplete and we're slowly chipping away at it. It should behave like the ruby implementation.

checkout

#TODO Support these formats
# '%G %V %w',
# '%G %V %u',
# '%C %g %V %w',
# '%C %g %V %u',
# '%Y %U %w',
# '%Y %U %u',
# '%Y %W %w',
# '%Y %W %u',
# '%C %y %U %w',
# '%C %y %U %u',
# '%C %y %W %w',
# '%C %y %W %u',
to see a bunch of time format stuff we haven't handled yet. The scenario highlighted by this issue is just one more to add to that list.

from timecop.

joshuacronemeyer avatar joshuacronemeyer commented on June 28, 2024 1

@krzyzak and @augustoccesar i'd appreciate if you'd have a look at my PR #379 for this issue. I'm open to suggestions on ways to better implement this.

from timecop.

joshuacronemeyer avatar joshuacronemeyer commented on June 28, 2024

thanks for the bug report @krzyzak are you interested in sending a PR with tests that demonstrate the fix?

from timecop.

augustoccesar avatar augustoccesar commented on June 28, 2024

I was looking into opening a PR for this issue, but from the short investigation that I did it seems that this is a very explicit expected behaviour.

d = Date._strptime(str, fmt) || Date.strptime_without_mock_date(str, fmt)
now = Time.now.to_date
year = d[:year] || now.year
mon = d[:mon] || now.mon

I guess to change to the expected behaviour described in this issue it would need to change to something like

d = Date._strptime(str, fmt) || Date.strptime_without_mock_date(str, fmt)
now = Time.now.to_date
year = d[:year] || now.year
mon = d[:mon] || 1

which feels like a large change from the perspective of expectation of how this method works (on timecop).

So I think that the main question is: Should the timecop Date.strptime behaves like the Ruby Date.strptime, or this an expected/desired behaviour to default to the current month?

from timecop.

krzyzak avatar krzyzak commented on June 28, 2024

@joshuacronemeyer yes, that indeed fixes my issue. Is there an option to release new gem version?

from timecop.

joshuacronemeyer avatar joshuacronemeyer commented on June 28, 2024

@krzyzak thanks for asking. I just released 0.9.5 that includes this change. Would appreciate you bumping your version and testing.

from timecop.

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.