Skip to content

Improve the precision of Date, Duration composition - #7867

Merged
laurmaedje merged 1 commit into
typst:mainfrom
cady-b:dtd
Mar 12, 2026
Merged

laurmaedje merged 1 commit into
typst:mainfrom
cady-b:dtd

Conversation

@cady-b

@cady-b cady-b commented Feb 14, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #7843 by upcasting Date to a PrimitiveDateTime during composition with Duration

outdated (see discussion below)

This caused two existing tests in tests/suite/foundations/datetime.typ to change; I believe those would be considered improvements.

I also explored unconditionally producing a full Datetime instead of checking if a Date suffices, but that touched more existing tests and I do like how Typst generally doesn't give unnecessary precision on user-facing stuff.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These date→datetime changes happen due to the internal implementation of today() in the current test runner. With #7853 applied they will be gone / fixed.

@cady-b cady-b Feb 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you sure this section should be affected by 7853?. I pulled your PR and re-ran the test-suite; adding the time to these two lines is still required in order to pass.

nvm I was thinking of 7856. I'll wait for 53 to merge and see if there are conflicts then

@cady-b cady-b Feb 16, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see. The PR was indeed affected; I'm pushing the changes now!

Thanks for the heads-up ^^

@cady-b
cady-b force-pushed the dtd branch 2 times, most recently from 7cb8247 to 2b1f25d Compare February 16, 2026 10:59
@laurmaedje laurmaedje added waiting-on-review This PR is waiting to be reviewed. scripting About Typst's coding capabilities fix A bug fix. labels Feb 16, 2026
@laurmaedje laurmaedje added foundations Related to the foundations category, which contains foundational types and elements. and removed scripting About Typst's coding capabilities labels Mar 2, 2026
@laurmaedje
laurmaedje added this pull request to the merge queue Mar 12, 2026
@laurmaedje

Copy link
Copy Markdown
Member

Thanks!

@laurmaedje laurmaedje removed the waiting-on-review This PR is waiting to be reviewed. label Mar 12, 2026
Merged via the queue into typst:main with commit ba33a67 Mar 12, 2026
8 checks passed
@cady-b
cady-b deleted the dtd branch March 12, 2026 17:42
jassielof pushed a commit to jassielof/typst that referenced this pull request Apr 7, 2026
Dikluwe pushed a commit to Dikluwe/typst-crystalline that referenced this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix A bug fix. foundations Related to the foundations category, which contains foundational types and elements.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Addition of datetime and duration is not composable

3 participants