jdate
postgres-jdate · Jalali calendar date, timestamp and range types
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102486 | jdate | postgres-jdate | 1.0.1 | TYPE | MIT | C |
PostgreSQL · 16, 17, 18
Usage
Sources:
jdate provides Jalali calendar dates, timestamps and ranges. Release 1.0.1 uses SQL extension version 1.0. Upstream requires PostgreSQL 16 or later and tests 16–18.
Enable and Convert
After installing the server files, a superuser creates the extension. No preload or restart is required. Choose the installation schema at creation: the extension cannot be relocated because some syntax overloads live in pg_catalog.
The results are 1403-01-01, 2024-03-20 and 1403-02.
Calendar Operations
Types include jdate, jtimestamp, jtimestamptz, jdaterange, jtsrange and jtstzrange, with B-tree/hash support for scalar types. jdate_part, jdate_trunc, jday_format and jmonth_format provide fields and reporting keys; jgenerate_series and jdate_bin generate or group time periods.
Month arithmetic clamps invalid month-end days. Weeks start on Saturday for Jalali week truncation. Cast untyped literals and parameters explicitly to avoid overload ambiguity. Text input uses Jalali dates; cast from core date/timestamp types to convert Gregorian values.
Boundaries and Maintenance
The finite calendar range is limited by the documented conversion algorithm; out-of-range casts or arithmetic fail. jtimestamptz display and local-day conversion depend on TimeZone; to_jdate from epoch seconds uses the UTC day. Use an explicit reporting zone for indexed expressions.
Patch releases retain SQL version 1.0, so no SQL update script is needed for 1.0.1. Backups require extension files on the restore server and superuser installation privileges.