bcgov / bcgov/common-document-generation-service

Carbone formatD() formatter using wrong timezone

Open
#106 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
26
Forks
14
PR merge metrics
No merged PRs in 30d

Description

A client recently found the formatD() formatter is not converting a date object into the correct readable string format.
```js
const 'myBirthday': '2024-01-30T14:43:00'

// in template:
{d.myMirthday:formatD("MM/DD/YYY HH:mm')} // renders as `01/20/2024 15:43`
```
an hour is being added to the time.

possible fix is to set the timezone when starting carbone
https://github.com/bcgov/common-document-generation-service/blob/2e5d24bb25bcff1942f3655651f3ac0895b3ae55/app/src/components/carboneRender.js#L103
see: https://carbone.io/documentation.html#date-manipulation

Contributor guide

Open the contributing guide

Research direction

Start in app/src/components/carboneRender.js around line 103 and compare how the Carbone renderer is initialized with the date-manipulation documentation. Reproduce the formatD() example and verify that the rendered time no longer gains an hour when the formatter processes the date object.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.