mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
change shorthand values to current timezone (thanks rpbertp13)
This commit is contained in:
parent
6301d87829
commit
3f72f31063
@ -197,7 +197,7 @@ See the wiki[http://github.com/adzap/validates_timeliness/wiki/Plugin-Parser] fo
|
|||||||
=== Restriction Shorthand
|
=== Restriction Shorthand
|
||||||
|
|
||||||
It is common to restrict an attribute to being on or before the current time or current day.
|
It is common to restrict an attribute to being on or before the current time or current day.
|
||||||
To specify this you need to use a lambda as an option value e.g. <tt>lambda { Time.now }</tt>.
|
To specify this you need to use a lambda as an option value e.g. <tt>lambda { Time.current }</tt>.
|
||||||
This can be tedious noise amongst your validations for something so common. To combat this the
|
This can be tedious noise amongst your validations for something so common. To combat this the
|
||||||
plugin allows you to use shorthand symbols for often used relative times or dates.
|
plugin allows you to use shorthand symbols for often used relative times or dates.
|
||||||
|
|
||||||
|
|||||||
@ -19,8 +19,8 @@ ValidatesTimeliness.setup do |config|
|
|||||||
#
|
#
|
||||||
# Shorthand date and time symbols for restrictions
|
# Shorthand date and time symbols for restrictions
|
||||||
# config.restriction_shorthand_symbols.update(
|
# config.restriction_shorthand_symbols.update(
|
||||||
# :now => lambda { Time.now },
|
# :now => lambda { Time.current },
|
||||||
# :today => lambda { Date.today }
|
# :today => lambda { Date.current }
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# Use the plugin date/time parser which is stricter and extendable
|
# Use the plugin date/time parser which is stricter and extendable
|
||||||
|
|||||||
@ -35,8 +35,8 @@ module ValidatesTimeliness
|
|||||||
# Shorthand time and date symbols for restrictions
|
# Shorthand time and date symbols for restrictions
|
||||||
mattr_accessor :restriction_shorthand_symbols
|
mattr_accessor :restriction_shorthand_symbols
|
||||||
@@restriction_shorthand_symbols = {
|
@@restriction_shorthand_symbols = {
|
||||||
:now => lambda { Time.now },
|
:now => lambda { Time.current },
|
||||||
:today => lambda { Date.today }
|
:today => lambda { Date.current }
|
||||||
}
|
}
|
||||||
|
|
||||||
def self.parser
|
def self.parser
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user