I am going to build a timeline with drag-n-drop functionality. Drag-n-drop works fine for me in IE, Chrome, FF and Safari.
Now for a timeline there is a range from -15x10^9
to 15x10^9
. I've tried to customize timeline.js and d3.js to fit this range. But after 10^6
it gives an error of NaN
.
I've referred this question as well.
Below is the code to test the max value in moment.js and it prints NaN
on console.
<script type="text/javascript">
var now = moment();
console.log(':::now:::',now);
var a = moment([-150000000, 0, 29]);
var b = moment([150000000, 0, 28]);
console.log(a.diff(b)); // 86400000
console.log([Number.MAX_VALUE, Number.MIN_VALUE]);
var iso_date = new Date(-15000000000).toISOString();
console.log(':::iso_date:::',iso_date); //1969-07-11T09:20:00.000Z
var string_date = new Date(-15000000000).toString();
console.log(':::string_date:::',string_date); //Fri Jul 11 1969 14:50:00 GMT+0530 (India Standard Time)
</script>
How do I accommodate this range in javascript and display it on a timeline?
Update: logarithmic scale