Giter Club home page Giter Club logo

Comments (12)

zedtux avatar zedtux commented on July 23, 2024

Little update: The issue is that when calling the Zip::DOSTime.now method (from the inheritance of Time) it return a Time class object instead of DOSTime.

from timecop.

kpolitowicz avatar kpolitowicz commented on July 23, 2024

This nasty workaround works for me for now:

Given /^the date is "([^"]*)"$/ do |date_string|
  Zip::DOSTime.instance_eval do
    def now ; Zip::DOSTime.new(Time.now.to_s) ; end
  end

  Timecop.travel DateTime.parse(date_string + " 00:00:00 -0500")
end

from timecop.

krisleech avatar krisleech commented on July 23, 2024

@kpolitowicz Thanks for the patch. I also had the same issue.

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

@kpolitowicz's do you think there's something that should go in the project, or just throw something in the README about dealing with Zip::DOSTime?

from timecop.

yaauie avatar yaauie commented on July 23, 2024

potential fix: yaauie/7c6f531b

Not tested for this particular use-case, but it should allow subclasses of Time, Date, and DateTime to interface with Timecop properly, and works with 1.8.x and 1.9.3.

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

@yaauie just wrote a script using Rubyzip to try it and it seems good. Thanks! 👍

from timecop.

kpolitowicz avatar kpolitowicz commented on July 23, 2024

@travisjeffery @yaauie Thanks, I'll try this out in my project as soon as the updated gem is released.

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

@kpolitowicz I've already pushed the gem. I messed up the month, but 0.4.5 is the version that has this change.

from timecop.

kpolitowicz avatar kpolitowicz commented on July 23, 2024

@travisjeffery I confirm, works like charm without my hack.

from timecop.

yaauie avatar yaauie commented on July 23, 2024

I realized I neglected to commit my tests. They are here: yaauie/c87ffc3f8

from timecop.

travisjeffery avatar travisjeffery commented on July 23, 2024

@kpolitowicz awesome. Thanks again @yaauie

from timecop.

carlosagp avatar carlosagp commented on July 23, 2024

@kpolitowicz +1. Thanks for that, it worked for me as well. I was experiencing the same problem but I was using the delorean gem.

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.