payloadcms / payloadcms/payload

Date field `timezone: true` writes empty string to `_tz` enum column in Postgres, causing `invalid input value for enum ...: ""`

Open
#16,283 1 comment 0 reactions 1 assignee View on GitHub

@paulpopus is already working on this.

Since Apr 15, 2026.

db: postgres invalid-reproduction
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
  1. Configure Payload with Postgres (Drizzle) adapter.
  2. Create a collection with a date field:
{
  name: 'startDate',
  type: 'date',
  timezone: true,
}
  1. Ensure there is no defaultTimezone set globally (config.admin.timezones.defaultTimezone) and no timezone.defaultTimezone on the field.
  2. Create or update a document setting startDate, leaving timezone unset.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.