-
Notifications
You must be signed in to change notification settings - Fork 228
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
toMillis: Allow width formatting without separators #545
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test case for Regex issue in which the min/max picture values are being ignored.
Adding a YMD case which appears to be failing.
Usage of n works except when there could be optional digits, i.e. [M#1] in which case we need to also supply a lower bound of occurrences.
andrew-coleman
approved these changes
Nov 2, 2021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Many thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug Summary
Width formatting doesn't appear to be respected without a separator. Corresponding issue: #546
Versions
JSONata
1.8.5
Node
v14.17.0
Detailed Information
Reference spec for width formatting: https://www.w3.org/TR/xpath-functions-31/#date-time-examples
At the moment, it appears the width formatting is not honored within
$toMillis
due to the way the regex is being generated. For an example input201802
, I should be able to specify a matcher[Y0001][M01]
which will result in a parsed value of2018/02/01
. At the moment, the library incorrectly grabs too many characters due to the+
regex so I end up with20180/02/01
Test Cases
[Y0001][M01]
[Y,*-4][M01]
[Y0001][M01][D01]]