Conversation
Co-authored-by: reorx <405972+reorx@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Partial dates do not seem to be supported.
Fix partial date support in JSON Editor
Jul 16, 2025
Owner
|
@copilot add a new work experience item to the sample.cv.json reflecting the issues concern: "There is also a need to omit or indicate null or present/current on a current job" |
…date and null endDate support Co-authored-by: reorx <405972+reorx@users.noreply.github.com>
Contributor
Author
Added a new work experience entry to sample.cv.json demonstrating current position support with partial date ("2023-01") and null endDate. The entry shows "Nucleus Labs" as a current position with endDate: null, addressing the need to indicate current/present jobs. Commit 2458445. |
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.
Problem
The JSONCV editor was unable to handle partial dates (YYYY or YYYY-MM formats) due to HTML date input restrictions. Users attempting to enter dates like "2018-01" or "2020" would encounter validation errors, even though the JSON schema pattern supported these formats.
Root Cause
The issue had two parts:
format: "date"property caused the editor to render HTML<input type="date">elements, which only accept full ISO dates (YYYY-MM-DD)"format": "date"and a permissive pattern that supports partial dates, creating a validation conflictSolution
1. Modified JSON Editor Configuration (
src/editor/main.js)2. Updated JSON Schema (
schema/jsoncv.schema.json)"format": "date"from iso8601 definition^([1-2][0-9]{3}-[0-1][0-9]-[0-3][0-9]|[1-2][0-9]{3}-[0-1][0-9]|[1-2][0-9]{3})$Supported Date Formats
The fix enables all three date formats that were intended to be supported:
20232023-012023-01-15Testing
✅ Schema Validation: All partial date formats validate correctly
✅ Date Rendering: Existing dayjs formatting handles partial dates properly
✅ Pattern Validation: Accepts valid formats, rejects invalid ones
✅ Input Behavior: Date fields now use text inputs allowing partial dates
✅ Backward Compatibility: Full dates continue to work as before
Example Usage
Users can now enter partial dates in work experience, education, projects, and other date fields:
{ "work": [ { "name": "Current Company", "position": "Developer", "startDate": "2023-01", "endDate": null }, { "name": "Previous Company", "position": "Junior Developer", "startDate": "2020", "endDate": "2022-12" } ] }This is particularly useful for:
Fixes #11.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.