search for: distance_of_time_in_word

Displaying 20 results from an estimated 23 matches for "distance_of_time_in_word".

2006 Mar 29
2
distance_of_time_in_words and Time classes
There is <%= distance_of_time_in_words(Time.now, @a_time) %> before xzy.<BR /> <!-- ^ this gives 2279 days --> This does not work because when @a_time is stored, even though it is a Time field and the class is Time, it includes a date. The Date isn''t even that days date its the year 2000, hence the 2279 days...
2007 Sep 18
0
distance_of_time_in_words hardcoded strings should be separated for easier localization
...ticket/9587 Thanks! Jesper Rønn-Jensen blog: www.justaddwater.dk ===== ActiveRecord::Errors has a placeholder (@@default_error_messages) for messages that can be overridden. Just the same way, the hardcoded time strings should be easily overridden without breaking or re-implementing the logic in distance_of_time_in_words. This patch creates a new placeholder for the hardcoded strings: @@time_messages = { :less_than_x_seconds => "less than %d seconds", :half_a_minute => "half a minute", ... } Now you are able to overwrite with Helpers::DateHelpers::time_messages[:less_than_x_...
2008 May 20
2
DateHelpers .. don' display.. ?
...#39;une minute" I get the correct answer.. but I I write in my view <%= time_ago_in_words(Time.now, include_seconds = false) -%> I get an error :wrong number of arguments (0 for 1) trace app/helpers/application_helper.rb:96:in `[]'' app/helpers/application_helper.rb:96:in `distance_of_time_in_words'' seems no argument is passed .. ?? what''s wrong in the view ? thanks for your advices -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails...
2008 Feb 03
4
Testing helper/view methods from script/console
Hi, Is it possible to test helper/view methods from script/console. I want to test the output of methods like distance_of_time_in_words. But it won''t let me from the console. What am I missing? TIA Luke -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to...
2006 May 10
3
formatted date down-counter - help!
I''d like to have a count down to a certain date, but display it in words, such as "123 days away" or something. I''m aware of the function "distance_of_time_in_words_to_now()", which will display "about 6 hours" or "12 days" or something like that, but how can I get it to reverse? Pass it a date for future reference, then it will error or be negative, right? Any thoughts? Thanks... -- Posted via http://www.ruby-forum.com/.
2010 Dec 15
4
distance_of_time_in_words shows {{count}} days instead of showing actual days
I have following code in view <% if @next_topic %> Time to show next topic <%= distance_of_time_in_words(Time.now.utc, @next_topic.time_to_show.utc) %> <hr /> <% end %> Output: Time to show next topic {{count}} days -------------------- time_to_show has following value Mon, 20 Dec 2010 12:38:00 UTC +00:00 @next_topic comes from database. I am using SQLITE. I am using Rails 2.3.8...
2007 Jul 31
11
helper spec not finding rails core helpers
...eHelper.html#M000574 The helper runs fine from my view templates, just dies in the spec test. I boiled my question down to a simple (not too useful) example. I''m not sure what I''m missing. # application_helper.rb module ApplicationHelper def app_foo t = Time.now distance_of_time_in_words( t, t + 50.minutes) return true end end # application_helper_spec.rb require File.dirname(__FILE__) + ''/../spec_helper'' describe ApplicationHelper do it "should find app_foo in application_helpers.rb" do app_foo.should be_true end end # error outpu...
2006 Jul 14
1
Converting Date string to Time Object
...odel with created_on specified as :date. This means that the day the record was created on is stored in the database as a string like "2006-04-28". I want to be able output a something like "5 days ago". From looking in the API I''ve found "strftime" and "*distance_of_time_in_words*". Distance_of_time_in_words only accepts Time objects and integers, so I guess my question is how do I convert "news.send("created_at")" to either a Time object or a integer? I''ve tried a few things like "news.send("created_at").to_i" but noth...
2007 Feb 21
2
date helper bug?
I''ve found an issue when trying to use the time_ago_in_words and distance_of_time_in_words from action view''s date_helper.rb Using SQL Server, I have a datetime column that gets returned as: "2007/02/21 09:54:00". When I pass this to time_ago_in_words (which just passes on to distance_of_time_in_words) it miscalculates the difference as "9 hours" (...um yea...
2011 May 23
4
Distance of time in days
In rails 3 there is distance_of_time_in_words which works fine, but I would like to tweak its output a bit. The thing is that if the dates are exactly the same it will say "Less Than a Minute" I would like it to show "Today" instead. Is that possible? Tiago Veloso ti.veloso-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org --...
2006 Jun 18
2
convert timespan to verbose description
Hi, I always see RoR pages showing the elapsed time like that ''Published 3 days, 23 hour and 5 minutes ago'' ''Published less than 3 minutes ago'' I guess this conversion can be done using a Rails function, however I can''t find it. Does somebody know its name?? Thanks a lot Peter
2006 May 08
7
How to get difference between two dates in days???
Hi, I want to calculate difference between Current date & previous date (stored in database). The difference should be in days. Hhow to do that?? PLs tell me. Thanx in advance. Prash -- Posted via http://www.ruby-forum.com/.
2011 May 20
4
Unable to figure out why a photo attribute of the paperclip plugin is not being passed in as a param
...; <div id = "latest_post"> </div> <%for a in @group_all_posts %> <%= image_tag a.photo.url %> <%= a.message %> by <%= Investor.find(a.post_by).first_name %> <div class ="contentdispgrp" id="style_chck"> <%= distance_of_time_in_words(a.created_at,Time.now) %> ago </div><br/><br/> <hr/> <%end%> I actually tried comparing this with the view file in my POC which successfully uploaded images for me and even displayed the same. The new.html.erb file of my POC looks like this:- <h1>N...
2011 Nov 02
4
undefined method `updated_at' for #<Classified:0x686c5e4>
...happens? Thanks See below: NoMethodError in Classified#show Showing app/views/classified/show.rhtml where line #17 raised: undefined method `updated_at'' for #<Classified:0x686c5e4> Extracted source (around line #17): 14: 15: <strong>Date Posted:</strong> <%= distance_of_time_in_words_to_now(@classified.created_at) %> ago <br /> 16: 17: <strong>Last updated:</strong> <%= distance_of_time_in_words(@classified.updated_at, Time.now) %> ago </p> 18: <p><%= @classified.description %></p> 19: 20: <hr/> RAILS_ROOT...
2006 Aug 13
0
Announcement: Really simple localization plugin
...===What it does This plugin modifies the following most used helpers for Rails * Sets UTF-8 content-type HTTP header * Sets UTF-8 connection to database * Localized monthnames on date_select etc. (but not changing the order of Y-M-D) * Localized ActiveRecord errors (and error headings) * Localized distance_of_time_in_words * Localized to_currency (but not changing the order of unit/currency) * Simple pluralization also available in the lang-file (but currently only used for pluralizing "error"=>"errors" in local language) * Changes standard Rails methods. In this way, there''s no tedio...
2006 Jul 07
3
calculate number of months difference between two dates
hi, Is there an easy way of calculating the difference in months between two dates in a controller. thanks -- Posted via http://www.ruby-forum.com/.
2006 May 24
0
distance_of_time_in_german_words
Hiall, This could be useful for those of you producing websites in the german language. Basically I copied the definition of the rails builtin distance_of_time_in_words and extracted another method german_words_for_distance_in_seconds. Just put these e.g. into module ApplicationHelper and you can use it in all views. def distance_of_time_in_german_words(from_time, to_time = 0, include_seconds = false) from_time = from_time.to_time if from_time.respond_to?(...
2006 Sep 12
1
Less verbose than time_ago_in_words method?
I''m trying to keep a Last Modified column in my record lists a fixed width and as narrow as possible. <td><%=time_ago_in_words record.updated_at%></td> However, making room for certain values like "less than a minute" force me to make the column twice as wide than, say, "12 hours" or "10 days". I would prefer "0
2008 Dec 14
0
Newbee met problems when do some i18n on rails
...locales'', ''*. {rb,yml}'')] config.i18n.default_locale = :''zh-CN'' But, when I restart my server and try to access the rails project via browser. I''ve got one message "can''t convert Array into String", it comes from this <%=h distance_of_time_in_words(Time.now, item.expiredate, true) %> And it seems everything related to data and time got this message. Any one can help me point out the problem I have? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on...
2006 Jul 17
0
Ruby-GetText-Package-1.7.0
Hi, Ruby-GetText-Package-1.7.0 is now available. Enjoy L10n! Changes ------- * Improve to support Ruby on Rails * Localize ActionView::Helpers::DateHelper.distance_of_time_in_words. * Localize ActionView::Helpers::ActiveRecordHelper.error_message_on. * Add ActiveRecord::Base.untranslate, .untranslate_all to prevend to translate columns. * "ID" fields are ignored as msgids. It won''t appear in po-files, now. * Fixed bugs, code cleanup. * Upda...