Consistent date and time formatting for the Lesli Framework.
Introduction
LesliDate provides date and time formatting utilities for applications built with the Lesli Framework.
It applies the host application's Lesli date, time-zone, and format configuration while providing compatible SQL expressions for SQLite and PostgreSQL.
Features
- Date, time, and date-time formatting
- Human-readable date and time formats
- Time-zone-aware parsing and output
- ISO 8601 and custom input formats
- SQLite- and PostgreSQL-compatible date expressions
- Database-safe current timestamp helpers
Installation
Add LesliDate to the application:
bundle add lesli_date
Usage
Format dates and times
Create a formatter from a Time, ISO 8601 string, or formatted date string:
datetime = LesliDate::Formatter.new(Time.current)
datetime.date.to_s
datetime.time.to_s
datetime.date_time.to_s
datetime.date_words.to_s
datetime.date_time_words.to_s
Pass the input format when parsing a custom string:
LesliDate::Formatter
.new("2026/07/19 14:30", "%Y/%m/%d %H:%M")
.date_time
.to_s
Database compatibility
Generate adapter-compatible SQL for timestamp columns:
formatter = LesliDate::Formatter.new.date_time
formatter.db_timestamps
formatter.db_column("published_at", "articles")
LesliDate::Compatibility.db_now
Development
Clone the repository and install its dependencies:
git clone https://github.com/LesliTech/LesliDate.git
cd LesliDate
bundle install
To use local source from a Lesli development workspace, reference it from the host application's Gemfile:
gem "lesli_date", path: "gems/LesliDate"
Tests
Run the default test task from the LesliDate directory:
bundle exec rake
Documentation
Community
License
Copyright (c) 2026, Lesli Technologies, S. A.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
The complete license text is available in the license file.
The Open-Source SaaS Development Framework for Ruby on Rails.
Last Update: 2026/07/19