Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Format string contains an unescaped latin alphabet character v" using "formatRelative" and "sk" locale #2083

Closed
MartinMikusat opened this issue Nov 14, 2020 · 1 comment · Fixed by #2540

Comments

@MartinMikusat
Copy link

MartinMikusat commented Nov 14, 2020

Here's a CodeSandbox with the issue
https://codesandbox.io/s/date-fns-bug-qf1db?file=/src/index.js

Doesn't happen with all dates, only some. I wasn't able to find any clues to what exactly is causing this.

@fturmel
Copy link
Member

fturmel commented Jun 29, 2021

Hi, I just stumbled on your issue.

This definitely is a bug. This error message comes from the format method. I tracked it down to a format string in the sk locale that is not escaped properly.

nextWeek Sun/Sat/Wed returns an unescaped string. The štvrtok string contains a v and would throw the error in your example. Should be an easy fix, I'll work on a PR.

return "'budúcu' " + weekday + " 'o' p"

var accusativeWeekdays = [
'nedeľu',
'pondelok',
'utorok',
'stredu',
'štvrtok',
'piatok',
'sobotu'
]

fturmel added a commit to fturmel/date-fns that referenced this issue Jun 29, 2021
See date-fns#2083, there is edge case formatting in the sk locale that can return an improperly escaped string and cause a runtime error.
@tan75 tan75 linked a pull request Jul 28, 2021 that will close this issue
kossnocorp pushed a commit that referenced this issue Jul 29, 2021
Fixed an edge case in the Slovak locale caused by unescaped character.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants