API overview
LesliDate has two public entry points:
| API | Purpose |
|---|---|
LesliDate::Formatter | Parse a date or time, apply the configured time zone, format it for display, or generate a formatted SQL selection |
LesliDate::Compatibility.db_now | Return the current-timestamp SQL expression for the active database adapter |
A formatter is mutable: calling date, time, or another format selector changes the output format and returns the same formatter instance.
formatter = LesliDate::Formatter.new(Time.current)
formatter.date.to_s
formatter.date_time_words.to_s
formatter.get
get returns a Date for calendar inputs and an ActiveSupport::TimeWithZone for instants. Calendar dates support only date selectors; time selectors raise LesliDate::InvalidFormat.
Use Parsing rules for accepted inputs, zones and errors, Formatter for display values, and Database expressions for SQL selection helpers.
Last Update: 2026/10/22