Module: OmnifocusMcp::Utils::IsoDate
- Defined in:
- lib/omnifocus_mcp/utils/iso_date.rb
Overview
Normalizes date strings to ISO 8601 for machine-oriented output (query results, resource JSON). Human-readable formatting lives in Tools::Definitions::DateFormatter.
Class Method Summary collapse
-
.to_date_only(value) ⇒ Object
Return a YYYY-MM-DD string, or
nilwhen the input is blank or unparseable.
Class Method Details
.to_date_only(value) ⇒ Object
Return a YYYY-MM-DD string, or nil when the input is blank or unparseable.
18 19 20 21 22 23 24 |
# File 'lib/omnifocus_mcp/utils/iso_date.rb', line 18 def to_date_only(value) return nil if Blank.blank?(value) Date.parse(value.to_s).strftime("%Y-%m-%d") rescue ArgumentError nil end |