File tree 2 files changed +35
-1
lines changed
2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -645,7 +645,12 @@ module.exports = function setConvert(ax, fullLayout) {
645
645
bnds = Lib . simpleMap ( brk . bounds , cleanNumber ) ;
646
646
b0 = bnds [ 0 ] ;
647
647
b1 = bnds [ 1 ] ;
648
- vb = ( new Date ( v ) ) . getUTCHours ( ) ;
648
+ var vDate = new Date ( v ) ;
649
+ vb = vDate . getUTCHours ( ) + (
650
+ vDate . getUTCMinutes ( ) * ONEMIN +
651
+ vDate . getUTCSeconds ( ) * ONESEC +
652
+ vDate . getUTCMilliseconds ( )
653
+ ) / ONEDAY ;
649
654
if ( bnds [ 0 ] > bnds [ 1 ] ) doesCrossPeriod = true ;
650
655
break ;
651
656
case '' :
Original file line number Diff line number Diff line change @@ -4195,6 +4195,35 @@ describe('Test axes', function() {
4195
4195
] ) ;
4196
4196
} ) ;
4197
4197
4198
+ it ( 'should discard coords within break bounds - date %H / high precision case' , function ( ) {
4199
+ _calc ( {
4200
+ x : [
4201
+ '2020-01-03 17:00' ,
4202
+ '2020-01-03 17:15' ,
4203
+ '2020-01-03 17:30' ,
4204
+ '2020-01-06 7:45' ,
4205
+ '2020-01-06 8:00' ,
4206
+ '2020-01-06 8:15' ,
4207
+ '2020-01-06 8:30'
4208
+ ]
4209
+ } , {
4210
+ xaxis : {
4211
+ breaks : [
4212
+ { pattern : '%H' , bounds : [ 17 , 8 ] }
4213
+ ]
4214
+ }
4215
+ } ) ;
4216
+ _assert ( 'with dflt operation' , [
4217
+ Lib . dateTime2ms ( '2020-01-03 17:00' ) ,
4218
+ BADNUM ,
4219
+ BADNUM ,
4220
+ BADNUM ,
4221
+ Lib . dateTime2ms ( '2020-01-06 8:00' ) ,
4222
+ Lib . dateTime2ms ( '2020-01-06 8:15' ) ,
4223
+ Lib . dateTime2ms ( '2020-01-06 8:30' )
4224
+ ] ) ;
4225
+ } ) ;
4226
+
4198
4227
it ( 'should discard coords within [values[i], values[i] + dvalue] bounds' , function ( ) {
4199
4228
var x = [
4200
4229
// Thursday
You can’t perform that action at this time.
0 commit comments