Giter Club home page Giter Club logo

Comments (5)

jeremyw avatar jeremyw commented on August 16, 2024

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.

mulder avatar mulder commented on August 16, 2024

What about %1I ?? that should suppress the leading space or 0.

from stamp.

jeremyw avatar jeremyw commented on August 16, 2024

@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.

scottmartin avatar scottmartin commented on August 16, 2024

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.

jeremyw avatar jeremyw commented on August 16, 2024

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)

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.