Giter Club home page Giter Club logo

Comments (7)

jeremyw avatar jeremyw commented on August 16, 2024

That's because '12' is used to disambiguate month values -- 12 is a tough one because it could be a valid month, day, or year. In this case it might make sense to infer that it's a day because it follows a month... will have to think about this.

In the meantime, I recommend using "Thu, Oct 31, 1988" as your example, because 31 is an obvious day value.

from stamp.

techiferous avatar techiferous commented on August 16, 2024

I've got a fix in the meantime, so no rush on my account. I figured you'd like to know about this edge case, though. It is a tough one, since your gem has to do some "interpretation" of what's passed into it. One possible strategy is to throw an error whenever stamp reads a date format that it finds ambiguous instead of stamp making a judgment call.

from stamp.

ghiculescu avatar ghiculescu commented on August 16, 2024

I've got a similar issue (and a workaround). I'm not sure what's special about the 22nd...

t = Time.now
=> 2012-10-30 15:33:20 +1000
t.stamp("22 October 2012")
=> "10 October 2012" # ooops
t.stamp("28 October 2012")
=> "30 October 2012"

from stamp.

jeremyw avatar jeremyw commented on August 16, 2024

@techiferous @ghiculescu Please update to 0.3.0 and let me know how it looks. I changed the way 2-digit values are disambiguated, which I think will avoid a lot of problems.

from stamp.

ghiculescu avatar ghiculescu commented on August 16, 2024

That's heaps better. Thanks very much for the prompt response!

from stamp.

jeremyw avatar jeremyw commented on August 16, 2024

@ghiculescu Awesome!

from stamp.

techiferous avatar techiferous commented on August 16, 2024

@jeremyw Thanks for fixing this. Sorry it's taken me so long to get back to you; I've been really swamped.

My previous fix was to remove the stamp gem in favor of strftime, which was guaranteed to be correct, since it was producing a bug in the app I was working on that I needed to fix immediately.

I trust that this fix works but I'm so swamped that I'm not going to take the time to re-install the stamp gem on my client's app. So sorry that I can't give you feedback on whether this works for me.

from stamp.

Related Issues (16)

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.