@@ -627,18 +627,19 @@ module.exports = function setConvert(ax, fullLayout) {
627
627
if ( brk . bounds ) {
628
628
var doesCrossPeriod = false ;
629
629
630
+ bnds = Lib . simpleMap ( brk . bounds , brk . pattern ?
631
+ cleanNumber :
632
+ ax . d2c // case of pattern: ''
633
+ ) ;
634
+ b0 = Math . min ( bnds [ 0 ] , bnds [ 1 ] ) ;
635
+ b1 = Math . max ( bnds [ 0 ] , bnds [ 1 ] ) ;
636
+
630
637
switch ( brk . pattern ) {
631
638
case WEEKDAY_PATTERN :
632
- bnds = Lib . simpleMap ( brk . bounds , cleanNumber ) ;
633
- b0 = bnds [ 0 ] ;
634
- b1 = bnds [ 1 ] ;
635
639
vb = ( new Date ( v ) ) . getUTCDay ( ) ;
636
640
if ( bnds [ 0 ] > bnds [ 1 ] ) doesCrossPeriod = true ;
637
641
break ;
638
642
case HOUR_PATTERN :
639
- bnds = Lib . simpleMap ( brk . bounds , cleanNumber ) ;
640
- b0 = bnds [ 0 ] ;
641
- b1 = bnds [ 1 ] ;
642
643
var vDate = new Date ( v ) ;
643
644
vb = vDate . getUTCHours ( ) + (
644
645
vDate . getUTCMinutes ( ) * ONEMIN +
@@ -650,23 +651,15 @@ module.exports = function setConvert(ax, fullLayout) {
650
651
case '' :
651
652
// N.B. should work on date axes as well!
652
653
// e.g. { bounds: ['2020-01-04', '2020-01-05 23:59'] }
653
- bnds = Lib . simpleMap ( brk . bounds , ax . d2c ) ;
654
- if ( bnds [ 0 ] <= bnds [ 1 ] ) {
655
- b0 = bnds [ 0 ] ;
656
- b1 = bnds [ 1 ] ;
657
- } else {
658
- b0 = bnds [ 1 ] ;
659
- b1 = bnds [ 0 ] ;
660
- }
661
654
// TODO should work with reversed-range axes
662
655
vb = v ;
663
656
break ;
664
657
}
665
658
666
659
if ( doesCrossPeriod ) {
667
660
if (
668
- ( op0 === '(' ? vb > b0 : vb >= b0 ) ||
669
- ( op1 === ')' ? vb < b1 : vb <= b1 )
661
+ ( op0 === '(' ? vb > b1 : vb >= b1 ) ||
662
+ ( op1 === ')' ? vb < b0 : vb <= b0 )
670
663
) return BADNUM ;
671
664
} else {
672
665
if (
0 commit comments