toMillis: Allow width formatting without separators #545
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]]