Skip to content

Fix YYYY date format rendering as "Jan YYYY" in HTML output#19

Merged
reorx merged 3 commits intomasterfrom
copilot/fix-18
Jul 17, 2025
Merged

Fix YYYY date format rendering as "Jan YYYY" in HTML output#19
reorx merged 3 commits intomasterfrom
copilot/fix-18

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jul 16, 2025

Fixed an issue where dates provided in YYYY format (e.g., "2023") were being rendered as "Jan YYYY" instead of just "YYYY" in the HTML output.

Problem

When startDate, endDate, or other date fields were provided in YYYY format, the dayjs library would default to January 1st of that year and format it as "Jan YYYY" when using the 'MMM YYYY' format. This affected all sections that display dates:

  • Work section: "2023" → "Jan 2023 – Present" ❌
  • Awards section: "2014" → "Jan 2014" ❌
  • Publications section: dates not displaying correctly ❌

Solution

Enhanced the dateRange and date functions in the EJS template to:

  1. Detect YYYY-only dates using regex pattern /^\d{4}$/ and display them as-is
  2. Handle YYYY-MM format using regex pattern /^\d{4}-\d{2}$/ and format as "MMM YYYY"
  3. Preserve existing behavior for YYYY-MM-DD and other formats
  4. Fix Publications section to use the correct releaseDate field name

Result

All date formats now render correctly:

  • YYYY format: "2023" → "2023" ✅
  • YYYY-MM format: "2014-10" → "Oct 2014" ✅
  • YYYY-MM-DD format: "2022-01-01" → "Jan 2022" ✅

Testing

Updated sample data to include various date formats and verified the fix works across all sections:

  • ✅ Work: "2023 – Present" (was "Jan 2023 – Present")
  • ✅ Education: "2011 – Jan 2014" (mixed formats working)
  • ✅ Awards: "2014" (was "Jan 2014")
  • ✅ Publications: "Oct 2014" (YYYY-MM format working)
  • ✅ Volunteer: Existing dates work correctly
  • ✅ Projects: Existing dates work correctly
![Fix working](https://github.com/user-attachments/assets/957cd62f-b340-42e0-b645-8d649df18217)

The screenshot shows the corrected date formatting in the Work section ("2023 – Present") and Awards section ("2014") without the unwanted "Jan" prefix.

Fixes #18.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 16, 2025 14:55
Co-authored-by: reorx <405972+reorx@users.noreply.github.com>
Co-authored-by: reorx <405972+reorx@users.noreply.github.com>
Copilot AI changed the title [WIP] YYYY date rendered as Jan YYYY in html Fix YYYY date format rendering as "Jan YYYY" in HTML output Jul 16, 2025
Copilot AI requested a review from reorx July 16, 2025 15:01
Copilot finished work on behalf of reorx July 16, 2025 15:01
@reorx reorx marked this pull request as ready for review July 17, 2025 00:50
@reorx reorx merged commit 566954e into master Jul 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

YYYY date rendered as Jan YYYY in html

2 participants