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
defaultTimezone set globally (config.admin.timezones.defaultTimezone) and no timezone.defaultTimezone on 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
Describe the Bug
When using Payload with Postgres (Drizzle adapter) and a
datefield configured withtimezone: 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
_tzcolumn 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) forstartDate_tz, since timezone is optional.https://github.com/payloadcms/payload/blob/main/packages/payload/src/fields/config/sanitize.ts#L545
baseTimezoneFieldreturns a hidden select and when there is no default timezone, the value serializes as an empty string instead ofnull/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
defaultTimezoneset globally (config.admin.timezones.defaultTimezone) and notimezone.defaultTimezoneon the field.startDate, leaving timezone unset.Which area(s) are affected?
db: postgres
Environment Info