payloadcms / payloadcms/payload
Date field `timezone: true` writes empty string to `_tz` enum column in Postgres, causing `invalid input value for enum ...: ""`
@paulpopus is already working on this.
Since Apr 15, 2026.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
When using Payload with Postgres (Drizzle adapter) and a date field configured with timezone: true, Payload auto-creates a hidden select field ${fieldName}_tz (e.g. startDate_tz). If no timezone is selected / no default timezone is configured, the request payload ends up writing "" (empty string) to the DB column.
The Postgres adapter generates the _tz column as a Postgres enum (from supported timezones). Postgres enums cannot accept "" unless it’s explicitly in the enum, so saving/updating the document fails with:
invalid input value for enum enum_<collection>_<field>_tz: ""
Timezones are intended to be optional, so “unset” should serialize to null / undefined (or omit the field), not "".
Saving a document with no timezone selected should store NULL (or omit) for startDate_tz, since timezone is optional.
https://github.com/payloadcms/payload/blob/main/packages/payload/src/fields/config/sanitize.ts#L545
baseTimezoneField returns a hidden select and when there is no default timezone, the value serializes as an empty string instead of null / undefined.
Link to the code that reproduces this issue
sorry I don't have the time for that but blocking users to report traceable bugs seems counter-productive
Reproduction Steps
- Configure Payload with Postgres (Drizzle) adapter.
- Create a collection with a date field:
{
name: 'startDate',
type: 'date',
timezone: true,
}
- Ensure there is no
defaultTimezoneset globally (config.admin.timezones.defaultTimezone) and notimezone.defaultTimezoneon the field. - Create or update a document setting
startDate, leaving timezone unset. - Observe 500 error and Postgres enum error.
Which area(s) are affected?
db: postgres
Environment Info
Binaries:
Node: 20.20.0
npm: 11.7.0
Yarn: N/A
pnpm: 10.28.0
Relevant Packages:
payload: 3.80.0
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025
Available memory (MB): 15676
Available CPU cores: 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.