On Nov 15, 2010, at 1:04 PM, jaclinuxhelp wrote: > Hi!: > > I guess ViewHints would be the right place to put that... but it > seems it is not supported by hobo. What i want, is a way to determine > centrally on my app the format that a given date field should use. > > Hope there is a way... or somebody implements this!
There's nothing Hobo-specific, since the ActiveSupport stuff works pretty well. Here's a sample from a production app: (in config/initializers/date_formats.rb): Time::DATE_FORMATS[:slashed] = "%m/%d/%Y" Time::DATE_FORMATS[:default] = "%m/%d/%Y %I:%M%p" Time::DATE_FORMATS[:ampm_time] = "%I:%M%p" Date::DATE_FORMATS[:default] = "%m/%d/%Y" Date::DATE_FORMATS[:slashed] = "%m/%d/%Y" the :default lines are the most important; they set what happens when view code calls to_s on a DateTime or Date object. See the ruby-core docs for strftime for the full list of specifiers. No idea how that interacts with localization, though - anybody who's done it have more info? --Matt Jones -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
