typst / typst/typst

support `repr:ordinal` for `display` on `datetime`

Open
#4,675 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature request scripting
Dominant language
Rust
Stars
56.1k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
22

Description

Description

in datetime.display there is a repr option for month, I'd also like one for day that allows the use of ordinals. For example:

#datetime(year: 2024, month: 08, day: 04).display("[day repr:ordinal] of [month repr:long] [year]) 

would turn into

4th of August 2021

what to name the repr I don't really care, just used ordinal as an example

Use Case

Displaying dates in a consistent matter that is more catered toward humans than machines, such as a diary/log entry in a book.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the datetime.display entry point and inspect how the existing month repr option is handled. Confirm the requested day ordinal behavior with the date-display example, and consider the work complete when the documented example produces the expected human-readable date.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
internationalization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.