Skip to content

[5.x]: Custom Date Fields not respecting site timezone in CSV exports #16588

@watarutmnh

Description

@watarutmnh

What happened?

Description

When exporting entries to CSV, custom Date fields are exported in UTC format, while system fields (dateCreated, dateUpdated) are correctly exported in the site's configured timezone (JST/UTC+9).

Steps to reproduce

  1. Configure Craft CMS site timezone to 'Asia/Tokyo' in config/general.php
  2. Create a custom Date field (with "Show Time Field" disabled)
  3. Create an entry and set a date value
  4. Export entries to CSV using the Expanded format

Expected behavior

Custom Date fields should be exported in the site's configured timezone (JST/UTC+9), matching the behavior of system fields.

Actual behavior

  • System fields (dateCreated, dateUpdated): Correctly exported in JST (UTC+9)
    Example: 2025-01-22T15:08:50+09:00
  • Custom Date fields: Exported in UTC
    Example: {"date":"1974-03-16 15:00:00"}

Additional Notes

  • This issue was observed after updating to 5.6.1, which fixed timezone handling for system fields in CSV exports (PR expanded export and datetime attrributes #16447)
  • The Control Panel correctly displays all dates in JST
  • Database correctly stores dates in UTC

Craft CMS version

Craft CMS version: 5.6.1

PHP version

PHP version: 8.4

Operating system and version

No response

Database type and version

Database: MySQL 8.0.40

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions