Comments (5)
It may be possible but would take some work. The issue is that strftime includes the space for single digit values with %l (for hour) and %e (for day of month). Stamp is simply inheriting the strftime behavior.
from stamp.
What about %1I ?? that should suppress the leading space or 0.
from stamp.
@tuker @mulder Nice, it looks like %1I
(that's a capital 'eye') works the same as %-I
, suppressing the leading space.
If you didn't catch it, this Bostonrb thread goes over it... http://groups.google.com/group/boston-rubygroup/browse_thread/thread/157927fdf102b93e/39b1b10aa3d3fbeb
I'd love to update Stamp to use this (if available in whatever Ruby you're using) but haven't had a real issue with the leading space myself yet. Ultimately I'd like to decouple Stamp from strftime.
from stamp.
Just incase anyone else needs this functionality right now and they don't know about squeeze, I've just been passing my formatted timestamps through it like date.stamp('Jan 1, 2000 at 1:59 PM').squeeze(' ')
. I didn't even know about squeeze until recently myself.
http://ruby-doc.org/core-1.9.3/String.html#method-i-squeeze
from stamp.
With help from @kbrock, we've decoupled stamp from strftime, which eliminates the leading space behavior. This is currently on the rip-strftime branch, and I plan to merge to master and release a new version of the gem soon.
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
- Allow ordinal numbers HOT 4
- Wrong dates for November HOT 6
- Problem with timezones in Rails HOT 3
- Wrong Date Presented HOT 7
- 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.