| Class | ValidatesTimeliness::Formats |
| In: |
lib/validates_timeliness/formats.rb
|
| Parent: | Object |
A date and time parsing library which allows you to add custom formats using simple predefined tokens. This makes it much easier to catalogue and customize the formats rather than dealing directly with regular expressions.
Formats can be added or removed to customize the set of valid date or time string values.
Adds new formats. Must specify format type and can specify a :before option to nominate which format the new formats should be inserted in front on to take higher precedence. Error is raised if format already exists or if :before format is not found.
Loop through format expressions for type and call proc on matches. Allow pre or post match strings to exist if strict is false. Otherwise wrap regexp in start and end anchors. Returns time array if matches a format, nil otherwise.