Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed May 5, 2019
1 parent 31e4a94 commit cd0b4f6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions samples/scales/time/financial.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
<button id="update">update</button>
<script>
function generateData() {
/**
* Returns true if outside 9:30am-4pm on a weekday
*/
var unit = document.getElementById('unit').value;

// Returns true if outside 9:30am-4pm on a weekday
function outsideMarketHours(date) {
if (date.isoWeekday() > 5) {
return true;
}
if ((unit == 'second' || unit == 'minute' || unit == 'hour')
if ((unit === 'second' || unit === 'minute' || unit === 'hour')
&& ((date.hour() < 9 && date.minute() < 30) || date.hour() > 16)) {
return true;
}
Expand All @@ -67,11 +67,10 @@
var date = moment('Jan 01 1990', 'MMM DD YYYY');
var now = moment();
var data = [];
var unit = document.getElementById('unit').value;
for (; data.length < 60 && date.isBefore(now); date = date.clone().add(1, unit).startOf(unit)) {
if (outsideMarketHours(date)) {
date = date.clone().add(8 - date.isoWeekday(), 'day');
if ((unit == 'second' || unit == 'minute' || unit == 'hour')) {
if ((unit === 'second' || unit === 'minute' || unit === 'hour')) {
date = date.hour(9).minute(30).second(0);
}
}
Expand Down

0 comments on commit cd0b4f6

Please sign in to comment.