X Tutup
Skip to content

Feature/add day placeholder to single date formatting (fixes #548)#571

Merged
sinaatalay merged 1 commit intorendercv:mainfrom
shraddhaa09:feature/add-day-placeholder-current-date
Feb 16, 2026
Merged

Feature/add day placeholder to single date formatting (fixes #548)#571
sinaatalay merged 1 commit intorendercv:mainfrom
shraddhaa09:feature/add-day-placeholder-current-date

Conversation

@shraddhaa09
Copy link
Contributor

This PR adds support for DAY and DAY_IN_TWO_DIGITS placeholders in date templates so that single_date: MONTH/DAY/YEAR renders the correct numeric day in CURRENT_DATE (e.g., 12/13/2025) instead of 12/DAY/2025.

Changes

Updated date_object_to_string in src/rendercv/renderer/templater/date.py to include day = int(date.strftime("%d")) and to populate DAY and DAY_IN_TWO_DIGITS in the placeholders dict.

Extended tests/renderer/templater/test_date.py with cases for:

DAY and DAY_IN_TWO_DIGITS on both Date(...) and "YYYY-MM-DD" inputs.

MONTH/DAY/YEAR to cover the configuration from issue #548.

Motivation
In issue #548, using single_date: MONTH/DAY/YEAR in top_note caused CURRENT_DATE to render as 12/DAY/2025 because DAY was not a supported placeholder. This PR adds the missing placeholders and tests.

Testing

Ran just test) in the Codespace; all tests pass (900 passed).

@faridrashidi
Copy link

Thanks you!

Setting single_date: MONTH/DAY/YEAR and using top_note: "Last updated: CURRENT_DATE" correctly displays the date (e.g., 12/23/2025).

Direct use fails in top_note: "Last updated: MONTH/DAY/YEAR" still shows (12/DAY/2025)

Should MONTH/DAY/YEAR placeholders work directly in top_note, or is only CURRENT_DATE supported there?

@YashJaingit0074
Copy link

YashJaingit0074 commented Dec 24, 2025

@faridrashidi check mine code it works with your condition . I have give the PR

@shraddhaa09
Copy link
Contributor Author

Thanks you!

Setting single_date: MONTH/DAY/YEAR and using top_note: "Last updated: CURRENT_DATE" correctly displays the date (e.g., 12/23/2025).

Direct use fails in top_note: "Last updated: MONTH/DAY/YEAR" still shows (12/DAY/2025)

Should MONTH/DAY/YEAR placeholders work directly in top_note, or is only CURRENT_DATE supported there?

Thanks for testing this.

top_note is currently designed to only resolve high-level placeholders like CURRENT_DATE.

Date formatting (including MONTH, DAY, and YEAR) is handled via single_date, which CURRENT_DATE uses internally.

Using MONTH/DAY/YEAR directly inside top_note isn’t supported at the moment, and this PR doesn’t change that. It only ensures CURRENT_DATE renders the full date correctly when single_date includes DAY.

Supporting raw date placeholders directly in top_note would be a separate feature discussion.

@faridrashidi
Copy link

Are you sure about that? I've found that adding single_date: YEAR and then using MONTH inside top_note: "Last updated: MONTH/YEAR" works perfectly well. Including the DAY in single_date doesn't seem particularly useful, since the day is rarely (if ever) used elsewhere in the CV. I think the only use-case is in the 'Last updated' note. It would be great to hear the developer's thoughts on this. @sinaatalay

@shraddhaa09
Copy link
Contributor Author

Are you sure about that? I've found that adding single_date: YEAR and then using MONTH inside top_note: "Last updated: MONTH/YEAR" works perfectly well. Including the DAY in single_date doesn't seem particularly useful, since the day is rarely (if ever) used elsewhere in the CV. I think the only use-case is in the 'Last updated' note. It would be great to hear the developer's thoughts on this. @sinaatalay

Good catch you’re right that MONTH and YEAR already work directly in top_note.

The underlying issue in #548 was that DAY wasn’t implemented as a placeholder at all, which caused CURRENT_DATE to render it literally when single_date included DAY.

This PR only adds the missing DAY and DAY_IN_TWO_DIGITS placeholders so that CURRENT_DATE renders correctly when used with single_date: MONTH/DAY/YEAR. It doesn’t change how top_note performs placeholder substitution otherwise.

Whether including the day in a CV is useful is definitely debatable, but this fixes the inconsistency when DAY is used in date templates. I’m happy to follow the maintainer’s direction if any further changes are desired.

@sinaatalay
Copy link
Member

Having a DAY placeholder in single-date template is fine, but it doesn't fully address #548. We also need those placeholders for the top note and the footer.

@shraddhaa09
Copy link
Contributor Author

I’ve added the requested DAY and DAY_IN_TWO_DIGITS placeholders for the top note and footer templates. All tests and formatting checks have passed.

@shraddhaa09
Copy link
Contributor Author

Hi @sinaatalay @faridrashidi , just checking in on this PR.
I’ve added DAY and DAY_IN_TWO_DIGITS support for single_date, top_note, and footer as discussed, and all checks are passing.
Please let me know if anything else is needed from my side. Thanks!

@faridrashidi
Copy link

Hi @shraddhaa09, I have no comment on this. The developer should decide whether to accept the PR.

@sinaatalay
Copy link
Member

I'll review this as soon as I’m back to working on RenderCV.

…#548) (rendercv#571)

- Add DAY placeholders to single date formatting
- Add tests for DAY placeholders
- Apply ruff formatting
- fix: expose DAY placeholders in top note and footer templates
- fix: apply ruff formatting for DAY placeholders
- refactor: extract build_date_placeholders, add DAY/DAY_IN_TWO_DIGITS support

Co-Authored-By: shraddha khetmalis <shraddhakhetmalis915@gmail.com>
Co-Authored-By: Sina Atalay <79940989+sinaatalay@users.noreply.github.com>
@sinaatalay sinaatalay force-pushed the feature/add-day-placeholder-current-date branch from f2e641a to 2649651 Compare February 16, 2026 12:39
@sinaatalay
Copy link
Member

Thank you!

@sinaatalay sinaatalay merged commit 9b26e3b into rendercv:main Feb 16, 2026
11 checks passed
yafei-ou pushed a commit to yafei-ou/rendercv that referenced this pull request Feb 27, 2026
…#548) (rendercv#571) (rendercv#571)

- Add DAY placeholders to single date formatting
- Add tests for DAY placeholders
- Apply ruff formatting
- fix: expose DAY placeholders in top note and footer templates
- fix: apply ruff formatting for DAY placeholders
- refactor: extract build_date_placeholders, add DAY/DAY_IN_TWO_DIGITS support

Co-authored-by: Sina Atalay <79940989+sinaatalay@users.noreply.github.com>
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.

4 participants

X Tutup