|
@@ -237,6 +237,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
// var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
|
|
// var strYesterday = `${yesterday.getFullYear()}-${TimeFormatter.padZero(yesterday.getMonth() + 1)}-${TimeFormatter.padZero(yesterday.getDate())}`
|
|
|
// var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
|
|
// var strTomorrow = `${tomorrow.getFullYear()}-${TimeFormatter.padZero(tomorrow.getMonth() + 1)}-${TimeFormatter.padZero(tomorrow.getDate())}`
|
|
|
if (isMember && data && data.daylights && data.daylights.length > 0) {
|
|
if (isMember && data && data.daylights && data.daylights.length > 0) {
|
|
|
|
|
+ debugger
|
|
|
var yesterdayDate = new Date(data.daylights[0].date + 'T' + data.daylights[0].sunset)
|
|
var yesterdayDate = new Date(data.daylights[0].date + 'T' + data.daylights[0].sunset)
|
|
|
var todaySunriseDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunrise)
|
|
var todaySunriseDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunrise)
|
|
|
var todaySunsetDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunset)
|
|
var todaySunsetDate = new Date(data.daylights[1].date + 'T' + data.daylights[1].sunset)
|
|
@@ -335,6 +336,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function updateNightStore(date, sunrise, sunset) {
|
|
function updateNightStore(date, sunrise, sunset) {
|
|
|
|
|
+ debugger
|
|
|
if (lastNightInfo && lastNightInfo.date.getDate() == new Date(date).getDate() &&
|
|
if (lastNightInfo && lastNightInfo.date.getDate() == new Date(date).getDate() &&
|
|
|
lastNightInfo.sunrise == sunrise &&
|
|
lastNightInfo.sunrise == sunrise &&
|
|
|
lastNightInfo.sunset == sunset
|
|
lastNightInfo.sunset == sunset
|
|
@@ -1092,12 +1094,14 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
|
|
|
|
|
function getSunsetDuration() {
|
|
function getSunsetDuration() {
|
|
|
if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
|
|
if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
|
|
|
|
|
+ global.sunsetDuration = TimeFormatter.durationFormate(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts)
|
|
|
return TimeFormatter.durationFormate(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts)
|
|
return TimeFormatter.durationFormate(authInfo.night_completed.sunrise_ts, authInfo.night_completed.sunset_ts)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var now = new Date()
|
|
var now = new Date()
|
|
|
if (props.isNight && sunsetDate) {
|
|
if (props.isNight && sunsetDate) {
|
|
|
if (now.getTime() > sunsetDate.getTime()) {
|
|
if (now.getTime() > sunsetDate.getTime()) {
|
|
|
|
|
+ global.sunsetDuration = TimeFormatter.countdown(sunsetDate.getTime())
|
|
|
return TimeFormatter.countdown(sunsetDate.getTime())
|
|
return TimeFormatter.countdown(sunsetDate.getTime())
|
|
|
}
|
|
}
|
|
|
// return TimeFormatter.countdown(sunsetDate.getTime())
|
|
// return TimeFormatter.countdown(sunsetDate.getTime())
|
|
@@ -1113,7 +1117,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var duration = (sunRise - sunSet) * 60 * 1000
|
|
var duration = (sunRise - sunSet) * 60 * 1000
|
|
|
-
|
|
|
|
|
|
|
+ global.sunsetDuration = TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
|
return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
|
|
|
|
|
|
// //COMPLETED
|
|
// //COMPLETED
|
|
@@ -1138,6 +1142,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
|
|
|
|
|
function getSunriseDuration() {
|
|
function getSunriseDuration() {
|
|
|
if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
|
|
if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
|
|
|
|
|
+ global.sunriseDuration = TimeFormatter.durationFormate(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts)
|
|
|
return TimeFormatter.durationFormate(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts)
|
|
return TimeFormatter.durationFormate(authInfo.day_completed.sunrise_ts, authInfo.day_completed.sunset_ts)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1145,6 +1150,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
debugger
|
|
debugger
|
|
|
if (!props.isNight && sunriseDate) {
|
|
if (!props.isNight && sunriseDate) {
|
|
|
if (now.getTime() > sunriseDate.getTime()) {
|
|
if (now.getTime() > sunriseDate.getTime()) {
|
|
|
|
|
+ global.sunriseDuration = TimeFormatter.countdown(sunriseDate.getTime())
|
|
|
return TimeFormatter.countdown(sunriseDate.getTime())
|
|
return TimeFormatter.countdown(sunriseDate.getTime())
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1159,7 +1165,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var duration = (sunSet - sunRise) * 60 * 1000
|
|
var duration = (sunSet - sunRise) * 60 * 1000
|
|
|
-
|
|
|
|
|
|
|
+ global.sunriseDuration = TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
|
return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
return TimeFormatter.calculateTimeDifference(new Date().getTime(), new Date().getTime() + duration);
|
|
|
}
|
|
}
|
|
|
|
|
|