ChronoKit-FP is a lightweight toolkit designed to make date and time handling in Free Pascal easier for everyone. Whether you're calculating business days, handling timezones, or formatting dates, ChronoKit-FP offers practical tools to simplify your work.
// Get today's date and add 5 business days
var
Today, NextWeek: TDateTime;
begin
Today := TChronoKit.GetToday;
NextWeek := TChronoKit.AddBusinessDays(Today, 5);
WriteLn('Next workday: ', TChronoKit.GetAsString(NextWeek, 'yyyy-mm-dd'));
end;ChronoKit-FP is a cross-platform date and time library for Free Pascal developers. If you've ever struggled with timezone handling or needed better date manipulation tools, ChronoKit-FP has you covered. It gives you everything you need to work with dates, times, and timezones in your Free Pascal applications.
Key Features:
- π Cross-Platform Timezone Support - Works on Windows and Linux
- β° 50+ DateTime Functions - Everything you need for date/time work
- πΌ Business Day Calculations - Built-in workday calculations
- π― Simple API - Clean, easy-to-use function names
- π§ͺ Well Tested - 130+ tests ensure everything works
- π Good Documentation - Complete API reference with examples
- π ChronoKit-FP: Toolkit for Dates & Times in Free Pascal
- Clone the repository:
git clone https://github.com/ikelaiah/chronokit-fp-
Open / start a new project in Lazarus IDE
-
Go to
PackageβOpen Package File (.lpk)... -
Navigate to the ChronoKit packages in the
packages/lazarus/folder and selectchronokit_fp.lpk -
In the package window that opens, click
Compile -
Click
Use β Add to Projectto install the package
The ChronoKit-FP package is now ready to use in your Lazarus project.
- Clone the repository:
git clone https://github.com/ikelaiah/chronokit-fp- Add the source directory to your project's search path.
uses
// Date Time manipulation unit
ChronoKit; // Date Time operationsprogram ChronoKitDemo;
uses
ChronoKit, SysUtils;
var
CurrentTime, NextWorkday: TDateTime;
TZInfo: TTimeZoneInfo;
BusinessHours: TInterval;
OffsetSign: string;
begin
// Basic date/time operations
CurrentTime := TChronoKit.GetNow;
NextWorkday := TChronoKit.NextBusinessDay(CurrentTime);
WriteLn('Current time: ', TChronoKit.GetAsString(CurrentTime, 'yyyy-mm-dd hh:nn:ss'));
WriteLn('Next workday: ', TChronoKit.GetAsString(NextWorkday, 'yyyy-mm-dd'));
// Business hours check (9 AM - 5 PM)
BusinessHours := TChronoKit.CreateInterval(
TChronoKit.StartOfDay(CurrentTime) + EncodeTime(9, 0, 0, 0),
TChronoKit.StartOfDay(CurrentTime) + EncodeTime(17, 0, 0, 0)
);
if TChronoKit.IsWithinInterval(CurrentTime, BusinessHours) then
WriteLn('β
Within business hours')
else
WriteLn('β Outside business hours');
// Timezone information
TZInfo := TChronoKit.GetTimeZone(CurrentTime);
if TZInfo.Offset >= 0 then
OffsetSign := '+'
else
OffsetSign := '-';
WriteLn('Timezone: ', TZInfo.Name, ' (UTC', OffsetSign, IntToStr(Abs(TZInfo.Offset) div 60), ')');
WriteLn('DST active: ', BoolToStr(TZInfo.IsDST, 'Yes', 'No'));
end.- Windows / Linux
- No external dependencies required
- Uses only standard Free Pascal RTL units
- Free Pascal Compiler (FPC) 3.2.2+
- Lazarus 4.0+ (for compiling example projects and test suites)
- Git for version control
For detailed documentation, check out:
- π API Cheat Sheet - Quick reference for all functions
- π Complete Documentation - Full guide and examples
You can use ChronoKit-FP to build all kinds of applications:
| Example Project | Description | Source Code |
|---|---|---|
| ChronoKit Example | Demonstrates the library's capabilities with practical use cases | View Example |
| Add Business Days | Calculate next business day, accounting for weekends and holidays | View Example |
| Quick Start Demo | Shows off what the library can do | View Example |
- Platform Support: Currently works on Windows 11 and Ubuntu 24.04.
- Timezone Database: Linux systems need timezone data installed (usually comes with most distributions).
- DST Detection:
- Windows: Has hardcoded US DST rules
- Linux: Uses the system's timezone database
- The library detects whether a given date/time falls within DST period
- Open the
TestRunner.lpiusing Lazarus IDE - Compile the project
- Run the Test Runner:
cd tests
./TestRunner.exe -a --format=plainWant to help out? Great! Feel free to submit a Pull Request. For big changes, please open an issue first so we can chat about it.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Free Pascal Dev Team for the Free Pascal compiler
- Lazarus IDE Team for such an amazing IDE
- The helpful folks on various online communities:
- Everyone who has helped make this project better