Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Improve the precision of Date, Duration composition#7867

Open
cady-b wants to merge 1 commit intotypst:mainfrom
cady-b:dtd
Open

Improve the precision of Date, Duration composition#7867
cady-b wants to merge 1 commit intotypst:mainfrom
cady-b:dtd

Conversation

@cady-b
Copy link
Contributor

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

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
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.

Copy link
Contributor Author

@cady-b cady-b Feb 16, 2026

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

Copy link
Contributor Author

@cady-b cady-b Feb 16, 2026

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 ^^

@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
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. waiting-on-review This PR is waiting to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Addition of datetime and duration is not composable

3 participants