|
|
@ -101,6 +101,7 @@ class Chart { |
|
|
|
* Draw days to show time |
|
|
|
*/ |
|
|
|
export function render_calendar(canvas, width, height, offset, data) { |
|
|
|
|
|
|
|
const margin = { |
|
|
|
top: 0, |
|
|
|
left: leftMargin, |
|
|
@ -120,7 +121,9 @@ export function render_calendar(canvas, width, height, offset, data) { |
|
|
|
let days = [] |
|
|
|
const year = data.beginTime.getFullYear() |
|
|
|
const month = data.beginTime.getMonth() |
|
|
|
for (var day = data.beginTime.getDate(); day <= data.endTime.getDate(); day++) { |
|
|
|
|
|
|
|
const n_days = Math.ceil((data.endTime- data.beginTime) / (1000 * 60 * 60 * 24)) |
|
|
|
for (var day = data.beginTime.getDate(); day <= (data.beginTime.getDate() + n_days); day++) { |
|
|
|
const dayBegin = new Date(year, month, day, 0, 1, 0) |
|
|
|
const noon = new Date(year, month, day, 12, 0, 0) |
|
|
|
noons.push(noon) |
|
|
@ -183,7 +186,9 @@ export function render_nights(canvas, width, height, offset, data) { |
|
|
|
|
|
|
|
const year = data.beginTime.getFullYear() |
|
|
|
const month = data.beginTime.getMonth() |
|
|
|
for (var day = data.beginTime.getDate(); day <= data.endTime.getDate(); day++) { |
|
|
|
|
|
|
|
const n_days = Math.ceil((data.endTime- data.beginTime) / (1000 * 60 * 60 * 24)) |
|
|
|
for (var day = data.beginTime.getDate(); day <= (data.beginTime.getDate() + n_days); day++) { |
|
|
|
const midnight = new Date(year, month, day, 0, 0, 0) |
|
|
|
const sunEphem = SunCalc.getTimes(new Date(year, month, day, 12, 0, 0), lat, lon) |
|
|
|
draw_box(midnight, sunEphem.nauticalDawn, 'night') |
|
|
@ -223,7 +228,9 @@ export function render_astronomy(canvas, width, height, offset, data) { |
|
|
|
let sunData = [] |
|
|
|
const year = data.beginTime.getFullYear() |
|
|
|
const month = data.beginTime.getMonth() |
|
|
|
for (var day = data.beginTime.getDate(); day <= data.endTime.getDate(); day++) { |
|
|
|
|
|
|
|
const n_days = Math.ceil((data.endTime- data.beginTime) / (1000 * 60 * 60 * 24)) |
|
|
|
for (var day = data.beginTime.getDate(); day <= (data.beginTime.getDate() + n_days); day++) { |
|
|
|
const midnight = new Date(year, month, day, 0, 0, 0) |
|
|
|
|
|
|
|
// Solar Ephemeris
|
|
|
|