Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
watarutmnh opened this issue Jan 30, 2025 · 1 comment
Open
Assignees
Labels

Comments

@watarutmnh
Copy link
Contributor

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

@i-just
Copy link
Contributor

i-just commented Feb 4, 2025

Hi, thanks for reporting! I raised a PR for this. It targets 4.15 and 5.7, as that’s a slight change in behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants