Skip to content

Fix/datetime#688

Merged
hmaier-fws merged 5 commits intodevelopfrom
fix/datetime
Feb 6, 2026
Merged

Fix/datetime#688
hmaier-fws merged 5 commits intodevelopfrom
fix/datetime

Conversation

@jwaspin
Copy link
Copy Markdown
Contributor

@jwaspin jwaspin commented Jul 2, 2024

v1.5.0-beta.28
Fixes issues when selecting precision for dates.

https://dev.mdeditor.org/

@jwaspin jwaspin requested a review from hmaier-fws July 2, 2024 16:29
@hmaier-fws
Copy link
Copy Markdown
Contributor

@jwaspin The precision values display properly on import, however there is an unexpected behavior that results in the date precision of a record, in active edit mode, being applied to records that are subsequently edited.

Steps to recreate

  1. Import test records from: https://raw.githubusercontent.com/adiwg/mdjson-examples/master/date-time/dateTest-mdeditor-20240702.json
  2. Edit first record ("Date test YMD-HMS") and observe the "Time Period Start Date" (= "2024-07-02T08:25:04-08:00").
  3. Select record name in left sidebar to exit edit mode.
  4. Edit last record ("Date test YYYY") and observe "Time Period Start Date" (= "2024").
  5. Select the edit icon to edit the first record ("Date test YMD-HMS"). Do not first exit edit mode as above.

Observed behavior

  • The "Time Period Start Date" for record "Date test YMD-HMS" has changed from its initial value ("2024-07-02T08:25:04-08:00") to the precision of the record that was previously in edit mode.
  • The edit icon turns red indicating a change.
  • Selecting "Cancel" does not revert the date to the initial precision.

Expected behavior:
Record date-time precision does not change unless the user selects a value from the Date "Precision" picklist.

@hmaier-fws hmaier-fws marked this pull request as draft July 3, 2024 00:50
@jwaspin jwaspin added the bug Unexpected problem or unintended behavior label Mar 4, 2025
hmaier-fws and others added 2 commits February 2, 2026 12:14
…tern problems.

1. Moved setPrecisionBasedOnDate() from init() to didReceiveAttrs() — didReceiveAttrs is the Ember lifecycle hook that
  fires both on initial render AND whenever attrs update. This ensures precision is re-detected whenever the underlying
  record changes (component reuse scenario).
  2. Added _suppressReformat flag — Wraps the setPrecisionBasedOnDate() call to prevent the selectedPrecisionChanged
  observer from reformatting date values during auto-detection. Since Ember observers fire synchronously during set(), the
  flag is true when the observer runs inside setPrecisionBasedOnDate(), and false afterward when the user explicitly
  changes precision from the dropdown.
@dvonanderson dvonanderson marked this pull request as ready for review February 5, 2026 20:11
@dvonanderson dvonanderson self-assigned this Feb 5, 2026
@dvonanderson
Copy link
Copy Markdown
Contributor

@hmaier-fws can we test this one

@hmaier-fws
Copy link
Copy Markdown
Contributor

@dvonanderson looks like this works. I'll merge it into develop.

closes #804

@hmaier-fws hmaier-fws linked an issue Feb 6, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@hmaier-fws hmaier-fws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@hmaier-fws hmaier-fws merged commit 13baba2 into develop Feb 6, 2026
@hmaier-fws hmaier-fws mentioned this pull request Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected problem or unintended behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dates-time values not displayed with proper precision on import

3 participants