Module: TaskWarrior::Validations
- Included in:
- Annotation, Task
- Defined in:
- lib/taskwarrior/validations.rb
Instance Method Summary collapse
Instance Method Details
#entry_cannot_be_in_the_future ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/taskwarrior/validations.rb', line 12 def entry_cannot_be_in_the_future if !entry.blank? && (entry > DateTime.now) errors.add(:entry, "can't be in the future") end rescue StandardError errors.add(:entry, 'must be comparable to DateTime') end |
#must_be_date_or_nil(sym) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/taskwarrior/validations.rb', line 5 def must_be_date_or_nil(sym) datish = send(sym) unless datish.nil? || datish.is_a?(DateTime) errors.add(sym, 'must be nil or a valid DateTime object') end end |