Module: DateUtil::Localize
- Included in:
- SimpleForm::Inputs::UiDatePickerInput
- Defined in:
- lib/date_util/localize.rb
Instance Method Summary collapse
-
#localized(value) ⇒ Object
stackoverflow.com/questions/7580238/how-do-i-parse-non-english-dates-with-datetime-strptime-in-ruby value.nil? ? nil : I18n.localize(value).
- #to_english_date(date_string, country_code = :sv) ⇒ Object
Instance Method Details
#localized(value) ⇒ Object
stackoverflow.com/questions/7580238/how-do-i-parse-non-english-dates-with-datetime-strptime-in-ruby
value.nil? ? nil : I18n.localize(value)
5 6 7 |
# File 'lib/date_util/localize.rb', line 5 def localized value value end |
#to_english_date(date_string, country_code = :sv) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/date_util/localize.rb', line 9 def to_english_date(date_string, country_code = :sv) case country_code.to_sym when :sv date_string.gsub(/may|okt/, 'may' => 'May', 'okt' => 'Oct') else raise ArgumentError, "Country code #{sw} not currently supported, please extend DateUtil::Localize" end end |