Sha256: 6d0579fa0d2b3503de868feaae5da580d0cada29790928f4bc867a6e1d7f34e8

Contents?: true

Size: 1.21 KB

Versions: 50

Compression:

Stored size: 1.21 KB

Contents

if defined? RHO_ME
	require 'dateME'
else
    require 'dateOrig'
end

#RHO
require 'rholang/localization_simplified'
# Modification of ruby constants
class Date
  alias_method :old_strftime, :strftime

  #FIXME as these are defined as Ruby constants, they can not be overwritten
  MONTHNAMES         = LocalizationSimplified::DateHelper::Monthnames
  ABBR_MONTHNAMES    = LocalizationSimplified::DateHelper::AbbrMonthnames
  DAYNAMES          = LocalizationSimplified::DateHelper::Daynames        #not in use by Rails
  ABBR_DAYNAMES     = LocalizationSimplified::DateHelper::AbbrDaynames    #not in use by Rails
  
  DATE_FORMATS	=	{ :short => "%e %b", :long => "%B %e, %Y", :db => "%Y-%m-%d", :number => "%Y%m%d" }
  #, :long_ordinal => lambda { |date| date.strftime("%B #{date.day.ordinalize}, %Y") }, # => "April 25th, 2007" :rfc822 => "%e %b %Y"
  DATE_FORMATS.merge!(LocalizationSimplified::DateHelper::DateFormats)

  def strftime(date)
  
    if LocalizationSimplified::get_cur_locale() == 'en'
        return old_strftime(date)
    end
    
    tmpdate=date.dup
    LocalizationSimplified::localize_strftime(tmpdate, self)
    old_strftime(tmpdate)
  end

  def to_formatted_s(type)
    strftime(DATE_FORMATS[type])
  end
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
rhodes-7.6.0 lib/framework/date.rb
rhodes-7.5.1 lib/framework/date.rb
rhodes-7.4.1 lib/framework/date.rb
rhodes-7.1.17 lib/framework/date.rb
rhodes-6.2.0 lib/framework/date.rb
rhodes-6.0.11 lib/framework/date.rb
rhodes-5.5.18 lib/framework/date.rb
rhodes-5.5.17 lib/framework/date.rb
rhodes-5.5.15 lib/framework/date.rb
rhodes-5.5.0.22 lib/framework/date.rb
rhodes-5.5.2 lib/framework/date.rb
rhodes-5.5.0.7 lib/framework/date.rb
rhodes-5.5.0.3 lib/framework/date.rb
rhodes-5.5.0 lib/framework/date.rb
tauplatform-1.0.3 lib/framework/date.rb
tauplatform-1.0.2 lib/framework/date.rb
tauplatform-1.0.1 lib/framework/date.rb
rhodes-3.5.1.12 lib/framework/date.rb
rhodes-3.3.5 lib/framework/date.rb
rhodes-3.4.2 lib/framework/date.rb