lib/timeliness/definitions.rb in timeliness-0.4.2 vs lib/timeliness/definitions.rb in timeliness-0.4.3
- old
+ new
@@ -193,19 +193,21 @@
def current_date_format=(value)
Thread.current["Timeliness.current_date_format"] = value
end
def current_date_format
- Thread.current["Timeliness.current_date_format"] ||= @current_date_format
+ Thread.current["Timeliness.current_date_format"] ||= Timeliness.configuration.ambiguous_date_format
end
# Get date format set for using current thread format setting
+ #
def date_format_set
instance_variable_get(:"@#{current_date_format}_date_format_set")
end
# Get datetime format set for using current thread format setting
+ #
def datetime_format_set
instance_variable_get(:"@#{current_date_format}_datetime_format_set")
end
# Use date formats that return ambiguous dates parsed in European format
@@ -220,12 +222,9 @@
self.current_date_format = :us
end
def compile_formats
@sorted_token_keys = nil
- @current_date_format = Timeliness.ambiguous_date_format
-
- self.current_date_format = @current_date_format
@time_format_set = FormatSet.compile(time_formats)
@us_date_format_set = FormatSet.compile(date_formats)
@us_datetime_format_set = FormatSet.compile(datetime_formats)
@euro_date_format_set = FormatSet.compile(date_formats.select { |format| US_FORMAT_REGEXP !~ format })