Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Conversation

@Acylation
Copy link
Collaborator

@Acylation Acylation commented Feb 4, 2025

Closes #994, #974

Possibly to close #430 if plugin-specified locale settings are required

https://forum.obsidian.md/t/properties-let-the-user-customize-the-way-dates-times-are-displayed-independently-from-os/64139

May fix #969 together if the date field detection is enhanced
May better handle #764

Currently in alpha stage, functions with bugs


@marcusolsson Hi! Since this is a significant change, could you take some time to review the design?

In short, I’m converting all date/datetime strings into ZonedDateTime objects internally, defaulting to the user’s local time. When displayed, the timezone info is truncated, behaving like PlainDate / PlainDateTime.

For edits in the Projects UI, only values with a different timezone offset from the user’s local zone will retain the offset suffix.

For example, if the user’s timezone is -05:00, adding one minute results in:

  • 2025-02-03T12:312025-02-03T12:32
  • 2025-02-03T12:31-05:002025-02-03T12:32
  • 2025-02-03T12:31-08:002025-02-03T12:32-08:00

mdbraber and others added 5 commits January 26, 2025 00:09
Add input event handler call to DateInput

Shift to local DateInput component

Reserve submitting null when no cache

Simplified date / datetime input

Clean up
Write date string back according to timezone

Only reserve non-local timezone marks, non-DST save. Possible solution should be providing settings to specify user zone

Add hint

Resume input events on date inputs

Extend date string support for timezoneId

Fix date parsing

Remove dayjs

Cancel default date filling in field creation

Refactor date string parsing

Clean up redundant comments and tests

Fix bugs on filters and card display

Fix calendar date range

Refactor calendar with Temporal

Seems buggy, needs unit test to calendar helpers

Refactor using Temporal

Stage 1: Handle most views and sorts, except for calendar
@marcusolsson
Copy link
Collaborator

How exciting! I've been following the news on Temporal in the past, but didn't realize it's ready to use these days. I may not be able to review this during this week, but I'll be sure to try this out and have some comments at the end of next week at the latest.

@Acylation
Copy link
Collaborator Author

Acylation commented Feb 4, 2025

That sounds great! Just to clarify, Temporal is not fully product-ready yet—I’m currently using the polyfill maintained by the FullCalendar team: fullcalendar/temporal-polyfill.

That said, there’s been exciting progress recently. Temporal documentation has been added to MDN, and it has entered the experimental stage in some browsers. While it’s still a long way from being fully mature, I’m considering early adoption.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal
https://developer.mozilla.org/en-US/blog/javascript-temporal-is-coming/

Regarding time zone handling, to align with Obsidian Properties UI’s behavior (Ref), we still need to use moment.js, since day.js lacks an equivalent to moment.parseZone or at least write our own parser and store a {Date & zone} / {dayjs.Dayjs & zone} type internally.

Definately not in a hurry and I'll be working on fixing minor bugs this week. Looking forward to your thoughts when you get a chance to try it out!

@Acylation Acylation changed the title Introduce Temporal to handle date and time [Conflict Resolved] WIP: Introduce Temporal to handle date and time [Conflict Resolved] Feb 20, 2025
- Ensure events display on the correct date, considering timezone
- Persist DnD date correctly in calendar view, considering timezone
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Recognize more date formats Date type column show as an text format Date format settings for project/view

3 participants