Giter Club home page Giter Club logo

Comments (11)

stopdropandrew avatar stopdropandrew commented on July 23, 2024

#70 should fix this as well.

from timecop.

rdpoor avatar rdpoor commented on July 23, 2024

Cool. Forgive me for a naive request: can you give me a pointer on how to incorporate your pull request into my git environment so I can test it? (Y'know, trust but verify and all that! :). I'm asking partly because the I'm not using ActiveSupport (specifically, Timecopy.active_support => nil), and it's not clear how the #to_r problem affects my case.

from timecop.

stopdropandrew avatar stopdropandrew commented on July 23, 2024

I take it back, I didn't fix DateTime. I can write a patch for that sometime tomorrow and include it here. As far as trying out my branch, you can, in your Gemfile, change:

gem 'timecop'

to

gem 'timecop', :git => 'https://github.com/stopdropandrew/timecop', :branch => 'nanosecond_fix'

from timecop.

rdpoor avatar rdpoor commented on July 23, 2024

Grazie. I'll wait until you've included a DateTime patch and then test out your gem branch.

from timecop.

stopdropandrew avatar stopdropandrew commented on July 23, 2024

I took a quick stab at it with no luck. Time/DateTime conversion is too much of a pain in the ass. I typically try to avoid using DateTime whenever possible. Sorry I couldn't help more.

from timecop.

rdpoor avatar rdpoor commented on July 23, 2024

A viable workaround that doesn't require any patching is to pre-truncate the time you pass to Timecop.freeze(), as in:

now_ = DateTIme.now
now = DateTime.new(now_.year, now_.month, now_.day, now_.hour, now_.minute, now_.second)
Timecop.freeze(now)

Not really pretty, but it works.

from timecop.

yaauie avatar yaauie commented on July 23, 2024

#89 should also resolve this.

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

This should be fixed in 0.6.2 which I just pushed.

from timecop.

yaauie avatar yaauie commented on July 23, 2024

❤️

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

Actually hold on, I thought this the same issue as another issue I just fixed but I'm actually testing it now (btw, it'd be helpful if you posted test cases in Test::Unit and even better if you made PRs with them) and it appears it didn't fix this.

from timecop.

rdpoor avatar rdpoor commented on July 23, 2024

btw, it'd be helpful if you posted test cases in Test::Unit

Done. See associated pull request. (Note: this is my first pull request -- I trust I followed protocol correctly.)

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.