Giter Club home page Giter Club logo

stamp's People

Contributors

christophermanning avatar gurgeous avatar jeremyw avatar kbrock avatar semanticart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stamp's Issues

Strange output when using #stamp("29/01/2013")

Hi. I'm calling #stamp with today's date as the parameter, and getting some weird output. It seems to work correctly when 31/12 is used as the stamp parameter, as suggested in the readme. That said, I thought I'd report it because the output - "28/13/2013" - doesn't contain any valid months, so I'm not sure how it came about.

1.9.3p286 :015 > d = Date.new(2013, 01, 28)
 => Mon, 28 Jan 2013 
 1.9.3p286 :017 > d.stamp "29/01/2013"
 => "28/13/2013" 
1.9.3p286 :016 > d.stamp "31/12/2013"
 => "28/01/2013" 

I'm using stamp 0.5.0, rails 3.2.11, and ruby 1.9.3.

Time Zone Support Broken

t = Time.current.stamp('14:00 UTC') and t = Time.current.in_time_zone('any time zone').stamp('14:00 UTC') both return just the time with the string UTC. For some reason UTC is not being parsed correctly and replaced with the actual timezone.

Alias #stamp method

Some people have expressed concern that the method name "stamp" isn't descriptive enough to people unfamiliar with the gem. Consider adding #stamp_like and #format_like as aliases.

Wrong dates for November

ruby-1.9.2-p180 :001 > require 'stamp'
=> true
ruby-1.9.2-p180 :002 > date = Date.new(2011, 11, 12)
=> #<Date: 2011-11-12 (4911755/2,0,2299161)>
ruby-1.9.2-p180 :003 > date.stamp("21 Aug 2011, 11:15pm")
=> "11 Nov 2011, 12:00am"

Should be "12 Nov 2011"

include Stamp not InstanceMethods

Why use included callback?

def self.included(klass)
    klass.class_eval do
      include InstanceMethods
    end
  end

  module InstanceMethods

I don't see any need for it. Just put everything in Stamp.

Problem with timezones in Rails

I know this gem isn't specifically written for Rails, but I'm having a small problem and I was hoping you might be able to point me in the right direction. I'm using Rails 3.2.6 and I'm running the following code in the Rails console:

Time.zone.now.format_like('January 1, 2000 at 1:59 PM %Z')
=> "June 21, 2012 at 10:16 PM UTC"
Time.zone.now.strftime('%B %e, %Y at %l:%M %p %Z')
=> "June 21, 2012 at 10:17 PM EDT"

My app is set up to use Eastern Time and the date and time seem correct. However, the timezone name should be 'EDT'. Just using strftime the timezone name works just fine.

Any ideas why this is happening?

implement templates with Temple

Temple seems to provide the compilation and transformations that are needed.
It is also quite quick. Many of the fast erb replacements are using it like slim and hamlit

but it adds a dependency.

if it sounds good, I'll look into this in my copious free time. (wanted to swing back in 2015... darn)

Allow ordinal numbers

I wanted to get your thoughts and maybe some ideas on how to implement this. I tried implementing it in my fork on Friday for a few hours but I just couldn't get it to work. (although regex isn't my forte)

Ideally, I would like to be able to do something like:

Time.now.stamp("31st Oct 2012")
# => "5th Nov 2012"

or even

Time.now.stamp("Oct 2nd 2012")
# => "Nov 5th 2012"

Stamp is built as a parser for strftime formats and currently Ruby's strftime doesn't support ordinals in the date. That's what it's so difficult to write it. =/

Let me know what you think.

Wrong Date Presented

1.9.2p320 :015 > Date.new(2012, 10, 1).format_like 'Thu, Oct 11, 1988'
=> "Mon, Oct 01, 2012"
1.9.2p320 :016 > Date.new(2012, 10, 1).format_like 'Thu, Oct 12, 1988'
=> "Mon, Oct 10, 2012"
1.9.2p320 :017 > Date.new(2012, 10, 1).format_like 'Thu, Oct 13, 1988'
=> "Mon, Oct 01, 2012"

Error is in the middle call.

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.