Compare commits

..

4 Commits
1.1.3 ... 1.1.4

Author SHA1 Message Date
Adam Meehan
a76fc112e7 release 1.1.4 2009-01-13 20:11:04 +11:00
Adam Meehan
575ff85346 Merge branch 'months' 2009-01-13 20:07:54 +11:00
Adam Meehan
7ed76b5161 removed i18n of month names from TODO 2009-01-13 20:07:24 +11:00
Adam Meehan
65ed8a657e format months names now respect i18n 2009-01-13 20:05:55 +11:00
5 changed files with 17 additions and 5 deletions

View File

@@ -1,3 +1,6 @@
= 1.1.4 [2009-01-13]
- Make months names respect i18n in Formats
= 1.1.3 [2009-01-13] = 1.1.3 [2009-01-13]
- Fixed bug where time and date attributes still being parsed on read using Rails default parser [reported by Brad (pvjq)] - Fixed bug where time and date attributes still being parsed on read using Rails default parser [reported by Brad (pvjq)]

View File

@@ -5,7 +5,7 @@ require 'date'
require 'spec/rake/spectask' require 'spec/rake/spectask'
GEM = "validates_timeliness" GEM = "validates_timeliness"
GEM_VERSION = "1.1.3" GEM_VERSION = "1.1.4"
AUTHOR = "Adam Meehan" AUTHOR = "Adam Meehan"
EMAIL = "adam.meehan@gmail.com" EMAIL = "adam.meehan@gmail.com"
HOMEPAGE = "http://github.com/adzap/validates_timeliness" HOMEPAGE = "http://github.com/adzap/validates_timeliness"

1
TODO
View File

@@ -1,5 +1,4 @@
- :format option - :format option
- :with_date and :with_time options - :with_date and :with_time options
- valid formats could come from locale file - valid formats could come from locale file
- formats to use month and day names from i18n
- add replace_formats instead add_formats :before - add replace_formats instead add_formats :before

View File

@@ -1,3 +1,5 @@
require 'date'
module ValidatesTimeliness module ValidatesTimeliness
# A date and time format regular expression generator. Allows you to # A date and time format regular expression generator. Allows you to
@@ -297,9 +299,17 @@ module ValidatesTimeliness
def month_index(month) def month_index(month)
return month.to_i if month.to_i.nonzero? return month.to_i if month.to_i.nonzero?
Date::ABBR_MONTHNAMES.index(month.capitalize) || Date::MONTHNAMES.index(month.capitalize) abbr_month_names.index(month.capitalize) || month_names.index(month.capitalize)
end end
def month_names
defined?(I18n) ? I18n.t('date.month_names') : Date::MONTHNAMES
end
def abbr_month_names
defined?(I18n) ? I18n.t('date.abbr_month_names') : Date::ABBR_MONTHNAMES
end
def microseconds(usec) def microseconds(usec)
(".#{usec}".to_f * 1_000_000).to_i (".#{usec}".to_f * 1_000_000).to_i
end end

View File

@@ -2,7 +2,7 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = %q{validates_timeliness} s.name = %q{validates_timeliness}
s.version = "1.1.3" s.version = "1.1.4"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Adam Meehan"] s.authors = ["Adam Meehan"]