Issue: not respecting the configured date format while creating new posts #725

Closed
opened 2026-10-05 03:02:24 +02:00 by adam · 4 comments
Owner

Describe the bug

I have a field like this:

{
  "title": "Publishing date",
  "name": "date",
  "type": "datetime",
  "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX",
  "default": "{{now}}",
  "isPublishDate": true
}

When I create a new content with this from the dashboard, the date format is not respected and it gives me something like date: 2025-03-17T05:47:48Z but when I click "Now" in the Front Matter sidebar, it gives me the correct format like date: 2025-03-17T11:18:47+05:30

To Reproduce
Steps to reproduce the behavior:

  1. Configure a date format like the one above.
  2. Create a new content.
  3. The date in the newly generated content front matter will be incorrectly formatted.
  4. Click "Now" in the date field in the Front Matter sidebar, it gives the date in the correct format.

Expected behavior

Instead, I would think Front Matter would respect the configured format when creating new content initially without having to manually set the date through the sidebar.

Device:

  • Front Matter CMS Version: 10.8.0
**Describe the bug** I have a field like this: ```json { "title": "Publishing date", "name": "date", "type": "datetime", "dateFormat": "yyyy-MM-dd'T'HH:mm:ssXXX", "default": "{{now}}", "isPublishDate": true } ``` When I create a new content with this from the dashboard, the date format is not respected and it gives me something like `date: 2025-03-17T05:47:48Z` but when I click "Now" in the Front Matter sidebar, it gives me the correct format like `date: 2025-03-17T11:18:47+05:30` **To Reproduce** Steps to reproduce the behavior: 1. Configure a date format like the one above. 2. Create a new content. 3. The date in the newly generated content front matter will be incorrectly formatted. 4. Click "Now" in the date field in the Front Matter sidebar, it gives the date in the correct format. **Expected behavior** Instead, I would think Front Matter would respect the configured format when creating new content initially without having to manually set the date through the sidebar. **Device:** - Front Matter CMS Version: 10.8.0 <!-- github-sync-id:2925451069 -->
adam closed this issue 2026-10-05 03:02:24 +02:00
Author
Owner

@pottekkat good catch. This has to do with the frontMatter.global.timezone setting that was not considered on the DateTime field. Actually, the page creation was working correctly. As the default setting is set to UTC.

You can change the setting's value to your timezone or set it to an empty string. That way, it takes the timezone of your editor.

@pottekkat good catch. This has to do with the `frontMatter.global.timezone` setting that was not considered on the `DateTime` field. Actually, the page creation was working correctly. As the default setting is set to UTC. You can change the setting's value to your timezone or set it to an empty string. That way, it takes the timezone of your editor. <!-- github-comment-id:2753520849 -->
Author
Owner

That makes sense. I set this frontMatter.global.timezone to an empty string, and it works as I want functionally. But I would assume this is still an issue and the dateFormat should be considered, right?

That makes sense. I set this `frontMatter.global.timezone` to an empty string, and it works as I want functionally. But I would assume this is still an issue and the `dateFormat` should be considered, right? <!-- github-comment-id:2753569476 -->
Author
Owner

Yes, I also changed the beta version's code to support the timezone in the DateTime field.

Yes, I also changed the beta version's code to support the timezone in the DateTime field. <!-- github-comment-id:2754290598 -->
Author
Owner

Version 10.9.0 just got released with this fix included.

Version 10.9.0 just got released with this fix included. <!-- github-comment-id:3022247631 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#725