mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
add parser config to initializer
This commit is contained in:
parent
8b199b3f10
commit
5f31f40413
@ -22,4 +22,16 @@ ValidatesTimeliness.setup do |config|
|
|||||||
# :now => lambda { Time.now },
|
# :now => lambda { Time.now },
|
||||||
# :today => lambda { Date.today }
|
# :today => lambda { Date.today }
|
||||||
# )
|
# )
|
||||||
|
#
|
||||||
|
# Add one or more formats making them valid. e.g. add_formats(:date, 'd(st|rd|th) of mmm, yyyy')
|
||||||
|
# config.parser.add_formats()
|
||||||
|
#
|
||||||
|
# Remove one or more formats making them invalid. e.g. remove_formats(:date, 'dd/mm/yyy')
|
||||||
|
# config.parser.remove_formats()
|
||||||
|
#
|
||||||
|
# Change the amiguous year threshold when parsing a 2 digit year
|
||||||
|
# config.parser.ambiguous_year_threshold = 30
|
||||||
|
#
|
||||||
|
# Treat ambiguous dates, such as 01/02/1950, as a Non-US date.
|
||||||
|
# config.parser.remove_us_formats
|
||||||
end
|
end
|
||||||
|
|||||||
@ -39,6 +39,10 @@ module ValidatesTimeliness
|
|||||||
:today => lambda { Date.today }
|
:today => lambda { Date.today }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def self.parser
|
||||||
|
Parser
|
||||||
|
end
|
||||||
|
|
||||||
# Setup method for plugin configuration
|
# Setup method for plugin configuration
|
||||||
def self.setup
|
def self.setup
|
||||||
yield self
|
yield self
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user