Comments (8)
Even the examples in the readme regarding timezone don't work!! :(
from stamp.
@ramaboo Can you add a failing test on a branch that reproduces the issue?
from stamp.
I don't know Minitest (Rspec here). The test is simple though in rails console type:
time = Time.utc(2011, 6, 9, 20, 52, 30)
time.stamp("23:59 UTC") #=> "20:52 PST"
And you will see it's broken.
from stamp.
Here's what I just got:
irb(main):002:0> time = Time.utc(2011,6,9,20,52,30)
=> 2011-06-09 20:52:30 UTC
irb(main):003:0> time.stamp("23:59 UTC")
=> "20:52 UTC"
I wonder if something is modifying the behavior of the Time class. Are you
in a Rails app? What version of Ruby/Rails?
On Mon, May 23, 2016 at 6:55 PM, David Singer [email protected]
wrote:
I don't know Minitest (Rspec here). The test is simple though in rails
console type:time = Time.utc(2011, 6, 9, 20, 52, 30)
time.stamp("23:59 UTC") #=> "20:52 PST"And you will see it's broken.
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#29 (comment)
from stamp.
Yeah Rails 4.2.6. I get the same thing as you but in your documentation you state the result should be "20:52 PST" not "20:52 UTC" I can't find a way to get `time.stamp('23:59 UTC') to return a string without UTC in it. No matter what I do it never turns UTC to PST or EST, etc.
from stamp.
That looks like a bad example in the documentation. However, I'm not sure convinced time zones are working correctly. I would expect stamp
to emit the zone of the time object you're operating on, but that's not happening. It's been a while since I've been in that code, but it appears to use ENV['TZ']
to determine the current zone, not based on the zone of the time object.
I don't have a ton of time to investigate further right now, but please let me know if you discover anything or come up with a fix.
from stamp.
require 'active_support/all'
Time.current.stamp("UTC")
# => "EDT"
Time.current.in_time_zone('MST').stamp("UTC")
# => "UTC"
looks like it probably thinks TimeWithZone is a Date and not a time.
will look into it
from stamp.
also of interest
DateTime.now.stamp("UTC")
# => "-04:00"
require "active_support/time"
ActiveSupport::TimeWithZone.send(:include, ::Stamp)
Time.current.in_time_zone('MST').stamp("UTC")
# => "MST"
the method is not defined in TimeWithZone (as we know) and it tries to create a Time
object but
ruby/2.2.2/gems/tzinfo-1.2.2/lib/tzinfo/timezone_period.rb:145
seems to be loosing the timezone. and the wrap
with timezone is not able to get it back in time.
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
- 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"
- 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.