jskherman / imprecv

A no-frills curriculum vitae (CV) template using Typst and YAML to version control CV data.
Apache License 2.0
319 stars 38 forks source link

Manual processing of month can be processed using Typst standard library #24

Closed JamesxX closed 2 months ago

JamesxX commented 2 months ago

https://github.com/jskherman/imprecv/blob/dfc034563d21e662e155f528b00914237f35f228/utils.typ#L1-L27

This can be achieved like so:

#let monthname(n, display: "short") = {
  datetime(month: n, day: 1, year: 0).display("[month repr:#display]")
}

This will throw on an invalid month so if that isn't desirable you should add another line to check if n is within the range 1 to 12.

jskherman commented 2 months ago

Yes, the datetime.display() function was used before for formatting but as pointed out in PR #22, Typst still only has English month names as the output. The current state is only a band-aid solution until Typst has proper support for other languages in datetime.display().

jskherman commented 2 months ago

Closing this since there is no more input, probably.