InseeFr / InseeFr/Trevas-TS

Support locale for date formating

Open
#139 0 comments 0 reactions 1 assignee Claimed by @romaintailhurat View on GitHub
enhancement
Dominant language
TypeScript
Stars
9
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Consider this VTL expression:

```vtl
cast(cast("2000-" || MOIS_COLLECTE || "-01", date), string, "MMMM")
```

It currently always returns `October` but we would like to return the localized name instead (`Octobre` for a french locale).

Since we are using `date-fns` for that, it way be as simple as:

- get the browser locale (`navigator.language` ?),
- infer what to use for `format` [here](https://github.com/InseeFr/Trevas-JS/blob/master/packages/trevas/src/utils/dates.js#L11), by using the [proper `date-fns` option](https://date-fns.org/docs/format#).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.