]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Support min and max dates on time scale
authorTanner Linsley <tannerlinsley@gmail.com>
Tue, 20 Oct 2015 03:23:01 +0000 (21:23 -0600)
committerTanner Linsley <tannerlinsley@gmail.com>
Tue, 20 Oct 2015 03:23:01 +0000 (21:23 -0600)
src/scales/scale.time.js

index ad1365dda747974a856c34a09df629b766b41874..88af1436bf414874d9dc0ccb0ad9619d1a4d6685 100644 (file)
                                        scaleLabelMoments.push(labelMoment);
                                }, this);
 
-                               this.firstTick = moment.min.call(this, scaleLabelMoments);
-                               this.lastTick = moment.max.call(this, scaleLabelMoments);
+                               if (this.options.time.min) {
+                                       this.firstTick = this.parseTime(this.options.time.min);
+                               } else {
+                                       this.firstTick = moment.min.call(this, scaleLabelMoments);
+                               }
+
+                               if (this.options.time.max) {
+                                       this.lastTick = this.parseTime(this.options.time.max);
+                               } else {
+                                       this.lastTick = moment.max.call(this, scaleLabelMoments);
+                               }
                        } else {
                                this.firstTick = null;
                                this.lastTick = null;