The date data type

Values whose data type is date represent the date component of some moment (the year, the month, and the day) in the "local" (a.k.a. "wall-clock") regime. Date values know nothing about timezones, and represent the date at some unspecified location. You can picture a date value as the number of days (or microseconds, if you prefer) to the start of the day in question from the start of some epoch—which number is then mapped using the proleptic Gregorian calendar to a date in the familiar year-month-day representation.

Notice that subtracting one date value from another date value produces an integer value: the number of days between the two specified days. The value is sensitive to Gregorian calendar leap years. Try this:

select pg_typeof('2019-02-14'::date - '2018-02-14'::date)::text as "data type of difference between dates";

This is the result:

 data type of difference between dates
---------------------------------------
 integer

Notice that this example takes advantage of the fact that the value of any data type, d, can be ::text typecast to a canonical representation and that a text value that uses the canonical representation format can be ::d typecast to a d value—and that the round trip is non-lossy.

Now try this:

select
  '2019-02-14'::date - '2017-02-14'::date as "not spanning a leap year",
  '2021-02-14'::date - '2019-02-14'::date as "spanning a leap year";

This is the result:

 not spanning a leap year | spanning a leap year
--------------------------+----------------------
                      730 |                  731