Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var timelineItemCount = getRandomInt(0, 19);
var dateArray = new Array();
    for(i=0;i<timelineItemCount;i++)
    {
        var today = new Date();
        var randomDates = randomDate(today, new Date(today.getFullYear(), today.getMonth(), today.getDate()+7));
        dateArray.push(randomDates);
    }   
    dateArray.sort(function compare(a, b) {
        return (a < b) - (a > b);
    });
    console.log(dateArray);
function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
}
function randomDate(start, end) {
    return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
}
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers