Comments (7)
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.
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.
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.
@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.
That's heaps better. Thanks very much for the prompt response!
from stamp.
@ghiculescu Awesome!
from stamp.
@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)
- include Stamp not InstanceMethods HOT 1
- Support CPAN/Time::Format-style directives HOT 4
- Alias #stamp method HOT 4
- "pm" doesn't work on 1.8.7/REE
- Add support for Rails i18n date/time formats HOT 1
- Idea: Suppress leading space for, e.g., "3:00pm" ? HOT 5
- Allow ordinal numbers HOT 4
- Wrong dates for November HOT 6
- Problem with timezones in Rails HOT 3
- Drop support for Ruby 1.8.7 HOT 4
- Strange output when using #stamp("29/01/2013") HOT 10
- Change "meridian" to "meridiem"
- Time Zone Support Broken HOT 8
- implement templates with Temple
- Disambiguator doesn't sit within the Stamp module, polluting global namespace HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from stamp.