etr2460 commented on a change in pull request #8817: [sip-15] Displaying
endpoints for all start/end time ranges
URL:
https://github.com/apache/incubator-superset/pull/8817#discussion_r367026197
##########
File path:
superset/assets/src/explore/components/controls/DateFilterControl.jsx
##########
@@ -576,11 +576,12 @@ export default class DateFilterControl extends
React.Component {
const endpoints = this.props.endpoints;
value = value
.split(SEPARATOR)
- .map((v, idx) =>
- moment(v).isValid()
- ? v.replace('T00:00:00', '') +
- (endpoints ? ` (${endpoints[idx]})` : '')
- : v || (idx === 0 ? '-∞' : '∞'),
+ .map(
+ (v, idx) =>
+ (v.replace('T00:00:00', '') || (idx === 0 ? '-∞' : '∞')) +
+ (endpoints && value.includes(SEPARATOR)
Review comment:
instead of using `value.includes` here, i think it's cleaner to use the 3rd
argument for the callback in map and check if the length of the array is > 1.
see details here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]