Skip to content

Instantly share code, notes, and snippets.

@nervetattoo
Created January 28, 2011 14:13
Show Gist options
  • Save nervetattoo/800297 to your computer and use it in GitHub Desktop.
Save nervetattoo/800297 to your computer and use it in GitHub Desktop.
var defaultTime = new Date(Date.now() + 3600 * 1000);
var hours = [];
for (var i = 0; i < 24; i++)
{
hours.push({
value : ("0" + i).slice(-2),
selected : (defaultTime.getHours() == i)
});
}
var minutes = [];
for (var i = 0; i < 60; i += 5)
{
minutes.push({
value : ("0" + i).slice(-2),
selected : (
(defaultTime.getMinutes() > i) &&
(defaultTime.getMinutes() <= (i + 5))
)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment