With ECMA-262 v6, the
Z must be present in the result of
Z and it gives only the precision provided. Nothing prohibits that.
Date() input, which is above and beyond because the JSON spec doesn't even require that.
ECMA-262 v6 spec,
The ECMA-262 v6 spec says,
Date.prototype.toISOString() This function returns a String value representing the instance in time corresponding to this time value. The
format of the String is the Date Time string format defined in 126.96.36.199. All fields are present in the String. The time zone is always UTC, denoted by the suffix Z**. If this time value is not a finite Number or if the year is not a value that can be represented in that format (if necessary using extended year format), a RangeError exception is thrown.
That says this,
Z is the time zone offset specified as "Z" (for UTC) or either "+" or "-" followed by a time expression
This format includes date-only forms:
It also includes “date-time” forms that consist of one of the above date-only forms immediately followed by one of the following time forms with an optional time zone offset appended:
PostgreSQL outputs only the minimum precision provided to the constructor, and without the
z (still in ISO 8601).
SELECT to_jsonb(dt::timestamp with time zone)
FROM ( VALUES