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

Question: Date Formats #140

Closed
x2764tech opened this issue Mar 3, 2020 · 2 comments
Closed

Question: Date Formats #140

x2764tech opened this issue Mar 3, 2020 · 2 comments
Labels
question Further information is requested

Comments

@x2764tech
Copy link
Contributor

Related to #139...

The current fmtDate function uses the regex /\{([a-z]+)\}|[^\{]+/yi

Which is used to match {YYYY}, {M}/{D}\n{YYYY}, etc...

However, passing it something with an open parenthesis without letters will discard the rest of the string.
Eg: {YYYY}{1}{M}, {YYYY}{{M} and ``{YYYY}{}{M}will be translated as{YYYY}`.

So the question is: What is the intended format for dates?

@leeoniya
Copy link
Owner

leeoniya commented Mar 3, 2020

hey @x2764tech

the format is simply to enclose any key strings [1] in {}. i have never seen a literal { inside of a formatted date string, so i'm not particularly interested in handling what i consider an extreme edge case.

i'm pretty certain we can just change the regex to /gi instead of /yi for this application since exec continues where it left off anyways, and the regex matches both cases - formatting tokens and "everything else". initial testing shows no issues. we can also drop stickyRegExp: false from https://github.com/leeoniya/uPlot/blob/master/rollup.config.js in this case.

[1] https://github.com/leeoniya/uPlot/blob/master/src/fmtDate.js#L63

@leeoniya leeoniya added the question Further information is requested label Mar 3, 2020
@leeoniya
Copy link
Owner

leeoniya commented Mar 3, 2020

closing this as resolved for now. if you can show a strong case for supporting curly braces in formatted date strings, we can re-open.

@leeoniya leeoniya closed this as completed Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants