Repository navigation
fix(datetime): preserve year while typing - #8002
Merged
martinjagodic merged 1 commit intoOct 23, 2026
Merged
Conversation
✅ Deploy Preview for decap-cms ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Member
|
Released in v3.17.2 |
Merged
3 of 9 tasks
dfdez
added a commit
to Feverup/decap-cms
that referenced
this pull request
Nov 10, 2026
Backport of upstream 295904e (decaporg#8002, fixes decaporg#7939). The input re-rendered from the formatted value on every keystroke, so a partial year ("0002") was rewritten. Keep the typed text while focused; drop it on blur.
dfdez
added a commit
to Feverup/decap-cms
that referenced
this pull request
Nov 13, 2026
…or fixes (#27) * fix(backend-github): restore ensurePullRequestLabel Re-apply the initial workflow label to a CMS pull request that has lost it, both when listing CMS refs (getCmsRefs) and when opening an unpublished entry (retrieveUnpublishedEntryData). This behaviour was missing from the source. PNW-3165 * fix(widgets): keep relation refs intact when list items move (PNW-3165) Saving a page after removing or inserting a module could write `ref: []` (or a neighbour's id) into modules below that point. RelationControl.loadInitialOptions captured onChange before awaiting the query. That onChange comes from ListControl.handleFieldChangeFor(index), bound at render time, so the late write landed on the item's OLD index. On a miss or a failed query (rate limit, cached failure) it wrote fromJS([]). - RelationControl (upstream decaporg#7497): try/catch around the query; bail on a failure or missing hits; call onChange with the original value, and only when something matched. Drop the Fever-only componentDidUpdate reload. - ListControl (upstream decaporg#7972): resolve the item's index from its key when the change fires; drop the change if the item is gone. Fall back to the creation index if keys and value are out of sync. - Specs: 4 relation + 3 list cases; 6 fail without the fix. 21 ListControl specs already fail on fork (props lack getWidget); unchanged. * fix(markdown): remove empty links when text is deleted (decaporg#7702) When a user deletes all text within a link in the visual markdown editor, the empty link markup was being left behind (visible when switching to raw markdown mode). This adds a Slate normalizer that automatically removes link nodes when they become empty (have no text content), ensuring the link markup is properly cleaned up along with the text. Fixes decaporg#7640 (cherry picked from commit f1f1d13) * fix: 7431 - code widget Ignore initial lang change to prevent false unsaved changes state (decaporg#7588) * fix: 7431 - code widget Ignore initial lang change to prevent false unsaved changes state * 7588: apply copilot nitpick Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Martin Jagodic <jagodicmartin1@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit 7576d1c) * fix(lib-util): do not retry a 403 whose body has no message Backport of the requestWithBackoff part of upstream 20c99e0. A 403 without a string `message` (proxy error, null body) threw a TypeError that the catch took for a network failure, retrying five times over ~55s. (cherry picked from commit 20c99e0, lib-util only) * fix(widget-relation): stop the options menu hanging when a search fails Backport of upstream 0c191ed (decaporg#7556) and 2f3bdd4. loadOptions had no catch: a failed query (rate limit, network) never called react-select's callback, so the menu stayed on "Loading..." until reload. With a search term, put the matches ahead of the selected options before truncating to options_length. * fix(widget-datetime): preserve the year while it is being typed Backport of upstream 295904e (decaporg#8002, fixes decaporg#7939). The input re-rendered from the formatted value on every keystroke, so a partial year ("0002") was rewritten. Keep the typed text while focused; drop it on blur. * fix(core): flag drafts that delete a file as a delete workflow again A merge renamed the read in processUnpublishedEntry from dataFile.deletedFile to dataFile.deleteFile, matching a typo in UnpublishedEntryDiff. Backends return deletedFile, so isDeleteWorkflow was always null and delete-workflow drafts were treated as normal publishes (toast and post-publish handling). Rename the type field to deletedFile; it is optional because only some backends report it. * chore: make lint:format and type-check pass on the fork CI stopped at lint:format (API.ts formatting), which also hid 13 type-check errors. All are type-only: - Stack methods on Implementation are optional: only the GitHub backend implements them, and stack actions only run with backend.stack. - stackPublishFailure/stackCloseFailure accept the error their callers pass. - Narrow mediaLibrary state.get('validation') to its declared type. - prettier on backend-github API.ts (missing semicolon, line wrap). * fix(widget-markdown): keep links whose only content is an image Empty-link cleanup used Node.string(), so [](href) normalized away with its image. Treat a link as empty only with no text and no void child. * fix(widget-code): save the first language picked on a field with no initial language With no saved lang and no default_language, mount never changed lang, so isLangInitialized stayed false and the user's first pick was dropped as the init write. --------- Co-authored-by: Eric Grill <694055+EricGrill@users.noreply.github.com> Co-authored-by: Dan Ford <22881850+dlford@users.noreply.github.com> Co-authored-by: Martin Jagodic <jagodicmartin1@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #7939.
The datetime widget uses a controlled native date input. While a user edits the year, Chromium can emit intermediate values such as
0002and0020. Decap immediately parses those values through Day.js and feeds the formatted parent value back into the input; Day.js normalizes years 0–99 into the 1900s, so0002-08-03becomes1902-08-03and interrupts the browser's native year-entry buffer.Keep the native input's exact value while it has focus, while continuing to send changes through the existing
onChangepath. On blur, the input goes back to rendering the normal formatted prop value. This prevents intermediate parsing from rewriting the active year without changing Decap's persisted value format.The regression test models the controlled parent rerender and verifies the intermediate
0002 -> 0020 -> 0202 -> 2026sequence remains intact.Test plan
pnpm exec jest packages/decap-cms-widget-datetime/src/__tests__/DateTimeControl.spec.js --runInBand— 6/6 passedpnpm run test:unit --runInBand— 119 suites / 1,496 tests passed (existing configured skips: 2 suites / 1,304 tests)pnpm exec eslint packages/decap-cms-widget-datetime/src/DateTimeControl.js packages/decap-cms-widget-datetime/src/__tests__/DateTimeControl.spec.js— passedpnpm run lint:js --quiet— passedpnpm run lint:format— passedpnpm run type-check— passedpnpm --filter decap-cms-widget-datetime build:esm— passedpnpm --filter decap-cms-widget-datetime build— passedChecklist
A picture of a cute animal (not mandatory but encouraged)
🐈