-
Notifications
You must be signed in to change notification settings - Fork 272
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
fix(ui5-daterange-picker): working with format pattern containing the delimiter #2873
fix(ui5-daterange-picker): working with format pattern containing the delimiter #2873
Conversation
Looks good to me. |
packages/main/src/DateRangePicker.js
Outdated
if (this.getFormat().oFormatOptions.pattern.indexOf(this._effectiveDelimiter) >= 0) { | ||
const midIndex = Math.round(value.length / 2); | ||
|
||
valuesArray[0] = value.slice(0, midIndex).split(this._effectiveDelimiter).join("").trim(); |
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.
.split(this._effectiveDelimiter).join("") -> this will remove all "-"s from the first part
same for the second part
Try running the function with "2020/01/01 - 2021/02/02" f.e.
You'll end up with "20200101" and "20210202" respectively.
IMO just get the mid index, everything from 0 to midIndex - 1 is the first part, and after mid index the second.
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.
This is done, because "2020/01/01 -" can't be formatted with our formatter, but 20200101 can. That's why i am removing the symbols that are breaking the formatting.
fixes: #2851