daterange_inclusive is an extension to the built-in
daterange range type. By default, daterange excludes
the upper bound of the range — [), whereas
daterange_inclusive does not — [].
Other than the covered range bound, there are no other differences between
daterange and daterange_inclusive.
This module is considered “trusted”, that is, it can be
installed by non-superusers who have CREATE privilege
on the current database.
At times, it is more convenient to output date ranges with inclusive upper bounds.
For example, it may apply to employees' absences. If an employee
is absent from January 1, 2025, to January 10, 2025, using the daterange
range type will prevent the database from outputting this date range in
its entirety. In such cases, you would need to manually subtract one day
from the output. The daterange_inclusive extension
addresses this issue.
CREATE EXTENSION daterange_inclusive;
SELECT daterange('[2024-01-01,2024-06-01]');
daterange
-------------------------
[2024-01-01,2024-06-02)
SELECT daterange_inclusive('[2024-01-01,2024-06-01]');
daterange_inclusive
-------------------------
[2024-01-01,2024-06-01]