formatDate
with week
and locale
options returns full ISO date instead of "Week #"
#7664
Open
1 task done
Labels
Reduced Test Case
https://codepen.io/poosham/pen/RwOdeOM
Do you understand that if a reduced test case is not provided, we will intentionally delay triaging of your ticket?
Which connector are you using (React/Angular/etc)?
No connector (vanilla JS)
Bug Description
If I call
formatDate
with optionsweek
andlocale
, I expect to get the week number along with the word translated (may vary depending on the value of the week option). However, what I get is the current date formatted with the given locale. For example:formatDate(new Date(), { week: 'long', locale: 'sv' })
This doesn't result in "Vecka 17" as I would have guessed, but instead I get "2024-04-27".
I've tracked down where things go wrong in the fc code.
buildFormattingFunc
from formatting-native.ts seems to be the issue here, notably this if-expression:if (standardDatePropCnt === 0 && extendedSettings.week)
Here, standardDatePropCnt is 1 instead of 0, so we never hit what's inside this if-statement, which is our week formatter.
The text was updated successfully, but these errors were encountered: