|
|
@@ -42,7 +42,7 @@ export default function TimelineFastSleep(props: {
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
- var real_time_zone = props.data.last_timezone?props.data.last_timezone.gmt:''
|
|
|
+ var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
|
|
|
|
|
|
var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
|
|
|
return TimeFormatter.timelineFormatTime(newTimestamp)
|
|
|
@@ -57,7 +57,7 @@ export default function TimelineFastSleep(props: {
|
|
|
// return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_start_time)
|
|
|
}
|
|
|
else {
|
|
|
- var real_time_zone = props.data.last_timezone?props.data.last_timezone.gmt:''
|
|
|
+ var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
|
|
|
var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
|
|
|
|
|
|
return TimeFormatter.timelineFormatTime(newTimestamp)
|
|
|
@@ -68,8 +68,6 @@ export default function TimelineFastSleep(props: {
|
|
|
}
|
|
|
|
|
|
function formateDate(currentStatus: string, obj: any, isEnd: boolean, isFastMode?: boolean) {
|
|
|
- var now = new Date()
|
|
|
- var seconds = now.getHours() * 3600 + now.getMinutes() * 60 + now.getSeconds()
|
|
|
if (currentStatus == 'WAIT_FOR_START') {
|
|
|
if (props.data.scenario == 'SLEEP') {
|
|
|
if (isEnd) {
|
|
|
@@ -119,7 +117,7 @@ export default function TimelineFastSleep(props: {
|
|
|
return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
|
|
|
}
|
|
|
else {
|
|
|
- var real_time_zone = props.data.last_timezone? props.data.last_timezone.gmt:''
|
|
|
+ var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
|
|
|
var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
|
|
|
if (diffTimeZone || multTimeZone) {
|
|
|
return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
|
|
|
@@ -136,7 +134,7 @@ export default function TimelineFastSleep(props: {
|
|
|
return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
|
|
|
}
|
|
|
else {
|
|
|
- var real_time_zone = props.data.last_timezone?props.data.last_timezone.gmt:''
|
|
|
+ var real_time_zone = props.data.last_timezone ? props.data.last_timezone.gmt : ''
|
|
|
var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
|
|
|
if (diffTimeZone || multTimeZone) {
|
|
|
return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
|
|
|
@@ -235,7 +233,7 @@ export default function TimelineFastSleep(props: {
|
|
|
}
|
|
|
if (props.data.fast && props.data.scenario != 'SLEEP') {
|
|
|
var timeZone = ''
|
|
|
- if (props.data.fast.real_end_timezone.gmt) {
|
|
|
+ if (props.data.fast.real_end_timezone && props.data.fast.real_end_timezone.gmt) {
|
|
|
timeZone = ' ' + props.data.fast.real_end_timezone.gmt
|
|
|
}
|
|
|
if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
|
|
|
@@ -268,15 +266,15 @@ export default function TimelineFastSleep(props: {
|
|
|
|
|
|
function getTZLocation() {
|
|
|
if (props.data.fast) {
|
|
|
- var name = props.data.fast.real_start_timezone.gmt
|
|
|
- if (props.data.fast.real_start_timezone.name) {
|
|
|
+ var name = props.data.fast.real_start_timezone ? props.data.fast.real_start_timezone.gmt : ''
|
|
|
+ if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.name) {
|
|
|
name = `${name} (${props.data.fast.real_start_timezone.name})`
|
|
|
}
|
|
|
return name
|
|
|
}
|
|
|
else {
|
|
|
- var name = props.data.sleep.real_start_timezone.gmt
|
|
|
- if (props.data.sleep.real_start_timezone.name) {
|
|
|
+ var name = props.data.sleep.real_start_timezone ? props.data.sleep.real_start_timezone.gmt : ''
|
|
|
+ if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.name) {
|
|
|
name = `${name} (${props.data.sleep.real_start_timezone.name})`
|
|
|
}
|
|
|
return name
|
|
|
@@ -294,7 +292,7 @@ export default function TimelineFastSleep(props: {
|
|
|
var current1 = dayjs()
|
|
|
var current
|
|
|
if (props.data.fast) {
|
|
|
- if (props.data.fast.real_start_timezone.id) {
|
|
|
+ if (props.data.fast.real_start_timezone && props.data.fast.real_start_timezone.id) {
|
|
|
current = dayjs().tz(props.data.fast.real_start_timezone.id)
|
|
|
offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
|
|
|
}
|
|
|
@@ -303,7 +301,7 @@ export default function TimelineFastSleep(props: {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- if (props.data.sleep.real_start_timezone.id) {
|
|
|
+ if (props.data.sleep.real_start_timezone && props.data.sleep.real_start_timezone.id) {
|
|
|
current = dayjs().tz(props.data.sleep.real_start_timezone.id)
|
|
|
offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()
|
|
|
}
|