almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.86k stars 1.48k forks source link

min and max value in options configuration #4246

Open shrenik007 opened 5 years ago

shrenik007 commented 5 years ago

Hi,

Is there any way to add datetime as min and max values. As of now I have seen only those examples where only new Date is used.

var options = {
            height: 200,
            {#zoomable: false,#}
            {#moveable: false,#}
            timeAxis: { scale: 'minute', step: 25 },
            showCurrentTime: true,
            min: new Date(2019, 1, 5),
            max: new Date(2019, 1, 6)
        };

Instead of new Date, is there any possibility for new DateTime or something like this?

If not, then how can I control the values displayed on the timeline xaxis for the first time when page is loaded?

mpf82 commented 5 years ago

It's all there in the docs: http://visjs.org/docs/timeline/#Configuration_Options

min Date or Number or String or Moment none Set a minimum Date for the visible range. It will not be possible to move beyond this minimum.

The JS date constructor also accepts a time value: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Date

And here are the docs for moment.js: https://momentjs.com/docs/