ソースを参照

timezone formate update

Leon 1 年間 前
コミット
e00ca92dba

+ 26 - 26
src/features/trackTimeDuration/components/CircadianDetailPopup.tsx

@@ -74,18 +74,18 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
         var isMulti = false;
         var tempTZ = '';
         if (props.record.fast) {
-            if (props.record.fast.real_start_time_zone) {
-                tempTZ = props.record.fast.real_start_time_zone
-                if (props.record.fast.real_start_time_zone != currentTZ) {
+            if (props.record.fast.real_start_timezone.gmt) {
+                tempTZ = props.record.fast.real_start_timezone.gmt
+                if (props.record.fast.real_start_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
 
-            if (props.record.fast.real_end_time_zone) {
-                if (tempTZ != props.record.fast.real_end_time_zone) {
+            if (props.record.fast.real_end_timezone.gmt) {
+                if (tempTZ != props.record.fast.real_end_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.record.fast.real_end_time_zone != currentTZ) {
+                if (props.record.fast.real_end_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
@@ -93,23 +93,23 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
         }
 
         if (props.record.sleep) {
-            if (props.record.sleep.real_start_time_zone) {
+            if (props.record.sleep.real_start_timezone.gmt) {
                 if (tempTZ == '') {
-                    tempTZ = props.record.sleep.real_start_time_zone
+                    tempTZ = props.record.sleep.real_start_timezone.gmt
                 }
-                else if (tempTZ != props.record.sleep.real_start_time_zone) {
+                else if (tempTZ != props.record.sleep.real_start_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.record.sleep.real_start_time_zone != currentTZ) {
+                if (props.record.sleep.real_start_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
 
-            if (props.record.sleep.real_end_time_zone) {
-                if (tempTZ != props.record.sleep.real_end_time_zone) {
+            if (props.record.sleep.real_end_timezone.gmt) {
+                if (tempTZ != props.record.sleep.real_end_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.record.sleep.real_end_time_zone != currentTZ) {
+                if (props.record.sleep.real_end_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
@@ -123,8 +123,8 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
     function getTitle() {
         if (props.record.status == 'COMPLETED') {
             var timestamp = props.record.first_real_check_time
-            if (props.record.first_time_zone) {
-                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_time_zone)
+            if (props.record.first_timezone) {
+                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_timezone.gmt)
             }
             return TimeFormatter.getDayOfWeek(new Date(timestamp).getDay(), true)
         }
@@ -137,8 +137,8 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
     function getSubTitle() {
         if (props.record.status == 'COMPLETED') {
             var timestamp = props.record.first_real_check_time
-            if (props.record.first_time_zone) {
-                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_time_zone)
+            if (props.record.first_timezone) {
+                timestamp = TimeFormatter.transferTimestamp(timestamp, props.record.first_timezone.gmt)
             }
             return TimeFormatter.dateDescription(timestamp, true)
         }
@@ -246,7 +246,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
 
         var fastRing: RealRing = null
         if (props.record.fast) {
-            var timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_time_zone)
+            var timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone.gmt)
             fastRing = {
                 color: global.fastColor ? global.fastColor : ColorType.fast,
                 startArc: startArc(timestamp),//startArc(props.record.fast.real_start_time),
@@ -260,7 +260,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
         var sleepRing: RealRing = null
         if (props.record.sleep && props.record.sleep.status == 'COMPLETED') {
             var timestamp = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time,
-                props.record.fast ? props.record.fast.real_end_time_zone : props.record.sleep.real_end_time_zone)
+                props.record.fast ? props.record.fast.real_end_timezone.gmt : props.record.sleep.real_end_timezone.gmt)
             sleepRing = {
                 color: global.sleepColor ? global.sleepColor : ColorType.sleep,
                 startArc: startArc(timestamp),//startArc(props.record.sleep.real_start_time),
@@ -269,7 +269,7 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
         }
         if (props.record.sleep && props.record.sleep.status == 'NOT_COMPLETED') {
             var timestamp = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time,
-                props.record.fast ? props.record.fast.real_end_time_zone : props.record.sleep.real_end_time_zone)
+                props.record.fast ? props.record.fast.real_end_timezone.gmt : props.record.sleep.real_end_timezone.gmt)
             sleepRing = {
                 color: global.sleepColor ? global.sleepColor : ColorType.sleep,
                 startArc: startArc(timestamp),//startArc(props.record.sleep.real_start_time),
@@ -694,9 +694,9 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             currentDot3.color = ColorType.fast
         }
         else {
-            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_time_zone)
-            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_time_zone)
-            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_time_zone)
+            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone.gmt)
+            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_timezone.gmt)
+            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_timezone.gmt)
             duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
             duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
             duration3 = durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)
@@ -962,9 +962,9 @@ export default function CircadianDetailPopup(props: { record: any, schedule?: an
             }
         }
         else {
-            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_time_zone)
-            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_time_zone)
-            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_time_zone)
+            timestamp = TimeFormatter.transferTimestamp(props.record.fast.real_start_time, props.record.fast.real_end_timezone.gmt)
+            timestamp2 = TimeFormatter.transferTimestamp(props.record.sleep.real_start_time, props.record.fast.real_end_timezone.gmt)
+            timestamp3 = TimeFormatter.transferTimestamp(props.record.sleep.real_end_time, props.record.fast.real_end_timezone.gmt)
             duration = durationArc(props.record.fast.real_start_time, props.record.sleep.real_start_time)
             duration2 = durationArc(props.record.sleep.real_start_time, props.record.sleep.real_end_time)
             duration3 = durationArc(props.record.sleep.real_end_time, props.record.fast.real_end_time)

+ 29 - 33
src/features/trackTimeDuration/components/RecordFastSleep.tsx

@@ -109,18 +109,18 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
         var isMulti = false;
         var tempTZ = '';
         if (props.data.fast) {
-            if (props.data.fast.real_start_time_zone) {
-                tempTZ = props.data.fast.real_start_time_zone
-                if (props.data.fast.real_start_time_zone != currentTZ) {
+            if (props.data.fast.real_start_timezone.gmt) {
+                tempTZ = props.data.fast.real_start_timezone.gmt
+                if (props.data.fast.real_start_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
 
-            if (props.data.fast.real_end_time_zone) {
-                if (tempTZ != props.data.fast.real_end_time_zone) {
+            if (props.data.fast.real_end_timezone.gmt) {
+                if (tempTZ != props.data.fast.real_end_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.data.fast.real_end_time_zone != currentTZ) {
+                if (props.data.fast.real_end_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
@@ -128,23 +128,23 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
         }
 
         if (props.data.sleep) {
-            if (props.data.sleep.real_start_time_zone) {
+            if (props.data.sleep.real_start_timezone.gmt) {
                 if (tempTZ == '') {
-                    tempTZ = props.data.sleep.real_start_time_zone
+                    tempTZ = props.data.sleep.real_start_timezone.gmt
                 }
-                else if (tempTZ != props.data.sleep.real_start_time_zone) {
+                else if (tempTZ != props.data.sleep.real_start_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.data.sleep.real_start_time_zone != currentTZ) {
+                if (props.data.sleep.real_start_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
 
-            if (props.data.sleep.real_end_time_zone) {
-                if (tempTZ != props.data.sleep.real_end_time_zone) {
+            if (props.data.sleep.real_end_timezone.gmt) {
+                if (tempTZ != props.data.sleep.real_end_timezone.gmt) {
                     isMulti = true
                 }
-                if (props.data.sleep.real_end_time_zone != currentTZ) {
+                if (props.data.sleep.real_end_timezone.gmt != currentTZ) {
                     isDiff = true
                 }
             }
@@ -421,8 +421,8 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
 
     function recordTime() {
         var timestamp = props.data.first_real_check_time
-        if (props.data.first_time_zone) {
-            timestamp = TimeFormatter.transferTimestamp(timestamp, props.data.first_time_zone)
+        if (props.data.first_timezone.gmt) {
+            timestamp = TimeFormatter.transferTimestamp(timestamp, props.data.first_timezone.gmt)
         }
         return TimeFormatter.dateDescription(timestamp, true)
     }
@@ -431,58 +431,54 @@ const RecordFastSleep = memo((props: { data: any, type: string, index: number, d
         var timeZoneFormatted = getTimezone()
 
         if (multiTimeZone) {
-            if (props.data.first_time_zone_id) {
+            if (props.data.first_timezone.id) {
                 if (Taro.getSystemInfoSync().platform == 'ios') {
-                    if (props.data.first_time_zone_id == dayjs.tz.guess()) {
+                    if (props.data.first_timezone.id == dayjs.tz.guess()) {
                         return recordTime()
                     }
                 }
                 else {
-                    if (props.data.first_time_zone == timeZoneFormatted) {
+                    if (props.data.first_timezone.gmt == timeZoneFormatted) {
                         return recordTime()
                     }
                 }
                 if (global.language == 'en') {
-                    return dayjs(props.data.first_real_check_time).tz(props.data.first_time_zone_id).format('MMM D z')
+                    return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
                 }
                 else {
-                    return dayjs(props.data.first_real_check_time).tz(props.data.first_time_zone_id).format('M月D日 z')
+                    return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
                 }
             }
 
-            if (props.data.first_time_zone == timeZoneFormatted) {
+            if (props.data.first_timezone.gmt == timeZoneFormatted) {
                 return recordTime()
             }
-            return recordTime() + ' ' + props.data.first_time_zone
+            return recordTime() + ' ' + props.data.first_timezone.gmt
             // return t('feature.common.multi_timezones')
         }
         if (diffTimeZone) {
-            if (props.data.first_time_zone_id) {
+            if (props.data.first_timezone.id) {
                 if (Taro.getSystemInfoSync().platform == 'ios') {
-                    if (props.data.first_time_zone_id == dayjs.tz.guess()) {
+                    if (props.data.first_timezone.id == dayjs.tz.guess()) {
                         return recordTime()
                     }
                 }
                 else {
-                    if (props.data.first_time_zone == timeZoneFormatted) {
+                    if (props.data.first_timezone.gmt == timeZoneFormatted) {
                         return recordTime()
                     }
                 }
-
-                // if (props.data.first_time_zone_id == dayjs.tz.guess()) {
-                //     return recordTime()
-                // }
                 if (global.language == 'en') {
-                    return dayjs(props.data.first_real_check_time).tz(props.data.first_time_zone_id).format('MMM D z')
+                    return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('MMM D z')
                 }
                 else {
-                    return dayjs(props.data.first_real_check_time).tz(props.data.first_time_zone_id).format('M月D日 z')
+                    return dayjs(props.data.first_real_check_time).tz(props.data.first_timezone.id).format('M月D日 z')
                 }
             }
-            if (props.data.first_time_zone == timeZoneFormatted) {
+            if (props.data.first_timezone.gmt == timeZoneFormatted) {
                 return recordTime()
             }
-            return recordTime() + ' ' + props.data.first_time_zone
+            return recordTime() + ' ' + props.data.first_timezone.gmt
             // return t('feature.common.different_timezone')
         }
         return recordTime()

+ 0 - 8
src/features/trackTimeDuration/components/Rings.rn.tsx

@@ -62,14 +62,6 @@ export default function Component(props: {
 
     function drawContent() {
         var time = new Date();
-        // if (timeObj.status != 'WAIT_FOR_START' && timeObj && (timeObj.fast || timeObj.sleep)) {
-        //     var timestamp = time.getTime()
-        //     //判断逻辑
-        //     if (timeObj.fast.real_start_time_zone || timeObj.sleep.real_start_time_zone) {
-        //         timestamp = TimeFormatter.transferTimestamp(timestamp, timeObj.fast.real_start_time_zone ? timeObj.fast.real_start_time_zone : timeObj.sleep.real_start_time_zone)
-        //         time = new Date(timestamp)
-        //     }
-        // }
         var seconds = time.getHours() * 3600 + time.getMinutes() * 60 + time.getSeconds();
         if (props.currentDot && props.currentDot.offset)
             seconds += props.currentDot.offset * 60

+ 31 - 59
src/features/trackTimeDuration/components/TimelineFastSleep.tsx

@@ -32,45 +32,17 @@ export default function TimelineFastSleep(props: {
     const [multTimeZone] = useState(props.multiTimeZone)
     const scenario = props.scenario ? props.scenario : useSelector((state: any) => state.scenario);
 
-    useEffect(() => {
-        // var split = new Date().toString().split(' ');
-        // var currentTZ = split[split.length - 2];
-        // if (props.data.fast) {
-        //     if (props.data.fast.real_start_time_zone && props.data.fast.real_start_time_zone != currentTZ) {
-        //         setDiffTimeZone(true)
-        //         return
-        //     }
-        //     if (props.data.fast.real_end_time_zone && props.data.fast.real_end_time_zone != currentTZ) {
-        //         setDiffTimeZone(true)
-        //         return
-        //     }
-        // }
-
-        // if (props.data.sleep) {
-        //     if (props.data.sleep.real_start_time_zone && props.data.sleep.real_start_time_zone != currentTZ) {
-        //         setDiffTimeZone(true)
-        //         return
-        //     }
-        //     if (props.data.sleep.real_end_time_zone && props.data.sleep.real_end_time_zone != currentTZ) {
-        //         setDiffTimeZone(true)
-        //         return
-        //     }
-        // }
-        // setDiffTimeZone(false)
-
-    }, [props.data])
-
 
     function formateTime(obj: any, isEnd: boolean, isFastMode?: boolean) {
         if (isEnd) {
             if (obj.real_end_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_time_zone)
+                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_timezone.gmt)
                 return TimeFormatter.timelineFormatTime(newTimestamp)
                 // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_end_time)
             }
             else {
 
-                var real_time_zone = props.data.last_time_zone
+                var real_time_zone = props.data.last_timezone.gmt
 
                 var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
                 return TimeFormatter.timelineFormatTime(newTimestamp)
@@ -80,12 +52,12 @@ export default function TimelineFastSleep(props: {
         else {
 
             if (obj.real_start_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_time_zone)
+                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_timezone.gmt)
                 return TimeFormatter.timelineFormatTime(newTimestamp)
                 // return diffTimeZone ? TimeFormatter.timelineFullFormatTime(newTimestamp) : TimeFormatter.timelineFormatTime(obj.real_start_time)
             }
             else {
-                var real_time_zone = props.data.last_time_zone
+                var real_time_zone = props.data.last_timezone.gmt
                 var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
 
                 return TimeFormatter.timelineFormatTime(newTimestamp)
@@ -140,14 +112,14 @@ export default function TimelineFastSleep(props: {
         }
         if (isEnd) {
             if (obj.real_end_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_time_zone)
+                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_end_time, obj.real_end_timezone.gmt)
                 if (diffTimeZone || multTimeZone) {
                     return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
                 }
                 return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
             }
             else {
-                var real_time_zone = props.data.last_time_zone
+                var real_time_zone = props.data.last_timezone.gmt
                 var newTimestamp = TimeFormatter.transferTimestamp(obj.target_end_time, real_time_zone)
                 if (diffTimeZone || multTimeZone) {
                     return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
@@ -157,14 +129,14 @@ export default function TimelineFastSleep(props: {
         }
         else {
             if (obj.real_start_time) {
-                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_time_zone)
+                var newTimestamp = TimeFormatter.transferTimestamp(obj.real_start_time, obj.real_start_timezone.gmt)
                 if (diffTimeZone || multTimeZone) {
                     return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
                 }
                 return TimeFormatter.dateDescription(newTimestamp, true, diffTimeZone || multTimeZone)
             }
             else {
-                var real_time_zone = props.data.last_time_zone
+                var real_time_zone = props.data.last_timezone.gmt
                 var newTimestamp = TimeFormatter.transferTimestamp(obj.target_start_time, real_time_zone)
                 if (diffTimeZone || multTimeZone) {
                     return TimeFormatter.getMonthAndDayByTimestamp(newTimestamp, true) + ' '
@@ -183,8 +155,8 @@ export default function TimelineFastSleep(props: {
     */
     if (props.data.fast && props.data.scenario != 'SLEEP') {
         var timeZone = ''
-        if (props.data.fast.real_start_time_zone) {
-            timeZone = ' ' + props.data.fast.real_start_time_zone
+        if (props.data.fast.real_start_timezone.gmt) {
+            timeZone = ' ' + props.data.fast.real_start_timezone.gmt
         }
         var desc = props.data.status == 'WAIT_FOR_START' ? '' : multTimeZone ? timeZone : ''
         if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED' && diffTimeZone) {
@@ -210,13 +182,13 @@ export default function TimelineFastSleep(props: {
 
 
         var timeZone = ''
-        if (props.data.sleep.real_start_time_zone) {
-            timeZone = ' ' + props.data.sleep.real_start_time_zone
+        if (props.data.sleep.real_start_timezone.gmt) {
+            timeZone = ' ' + props.data.sleep.real_start_timezone.gmt
         }
         var strDate = multTimeZone ? timeZone : ''
         if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
             if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                strDate = props.data.last_time_zone
+                strDate = props.data.last_timezone.gmt
             }
         }
 
@@ -236,8 +208,8 @@ export default function TimelineFastSleep(props: {
     }
     if (props.data.sleep && props.data.scenario != 'FAST') {
         var timeZone = ''
-        if (props.data.sleep.real_end_time_zone) {
-            timeZone = ' ' + props.data.sleep.real_end_time_zone
+        if (props.data.sleep.real_end_timezone.gmt) {
+            timeZone = ' ' + props.data.sleep.real_end_timezone.gmt
         }
         var status = getStatus(false, false, props.data)
         var strContent: string = props.data.status == 'WAIT_FOR_START' ? formateDate(props.data.status, props.data.sleep, true, false) + ' ' + scenario.schedule.sleep.end_time : formateDate(props.data.status, props.data.sleep, true) + ' ' + formateTime(props.data.sleep, true, false)
@@ -245,7 +217,7 @@ export default function TimelineFastSleep(props: {
 
         if (props.data.status != 'WAIT_FOR_START' && props.data.status != 'COMPLETED') {
             if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                strDate = props.data.last_time_zone
+                strDate = props.data.last_timezone.gmt
             }
         }
 
@@ -265,12 +237,12 @@ export default function TimelineFastSleep(props: {
     }
     if (props.data.fast && props.data.scenario != 'SLEEP') {
         var timeZone = ''
-        if (props.data.fast.real_end_time_zone) {
-            timeZone = ' ' + props.data.fast.real_end_time_zone
+        if (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') {
             if ((!timeZone || timeZone.length == 0) && (multTimeZone || diffTimeZone)) {
-                timeZone = props.data.last_time_zone
+                timeZone = props.data.last_timezone.gmt
             }
         }
 
@@ -298,16 +270,16 @@ export default function TimelineFastSleep(props: {
 
     function getTZLocation() {
         if (props.data.fast) {
-            var name = props.data.fast.real_start_time_zone
-            if (props.data.fast.real_start_time_zone_name) {
-                name = `${name} (${props.data.fast.real_start_time_zone_name})`
+            var name = props.data.fast.real_start_timezone.gmt
+            if (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_time_zone
-            if (props.data.sleep.real_start_time_zone_name) {
-                name = `${name} (${props.data.sleep.real_start_time_zone_name})`
+            var name = props.data.sleep.real_start_timezone.gmt
+            if (props.data.sleep.real_start_timezone.name) {
+                name = `${name} (${props.data.sleep.real_start_timezone.name})`
             }
             return name
         }
@@ -324,21 +296,21 @@ export default function TimelineFastSleep(props: {
         var current1 = dayjs()
         var current
         if (props.data.fast) {
-            if (props.data.fast.real_start_time_zone_id) {
-                current = dayjs().tz(props.data.fast.real_start_time_zone_id)
+            if (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()
             }
             else {
-                offset = TimeFormatter.timeZoneOffset(props.data.fast.real_start_time_zone)
+                offset = TimeFormatter.timeZoneOffset(props.data.fast.real_start_timezone.gmt)
             }
         }
         else {
-            if (props.data.sleep.real_start_time_zone_id) {
-                current = dayjs().tz(props.data.sleep.real_start_time_zone_id)
+            if (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()
             }
             else {
-                offset = TimeFormatter.timeZoneOffset(props.data.sleep.real_start_time_zone)
+                offset = TimeFormatter.timeZoneOffset(props.data.sleep.real_start_timezone.gmt)
             }
         }
         // offset = current.date() * 24 * 60 + current.hour() * 60 + current.minute() - current1.date() * 24 * 60 - current1.hour() * 60 - current1.minute()

+ 2 - 2
src/features/trackTimeDuration/components/WeekCalendarItem.tsx

@@ -55,10 +55,10 @@ export default function WeekCalendarItem(props: { data: any, isCurrentWeek: bool
                 var real_start = item.real_start_time
                 var real_end = item.real_end_time
 
-                if (item.real_end_time_zone_id) {
+                if (item.real_end_timezone.id) {
 
 
-                    var strEnd = dayjs(real_end).tz(item.real_end_time_zone_id).format('YYYY-MM-DDTHH:mm:ss')
+                    var strEnd = dayjs(real_end).tz(item.real_end_timezone.id).format('YYYY-MM-DDTHH:mm:ss')
                     var duration = real_end - real_start
                     // if (index = 1) {
                     //     if (new Date(strEnd)) {

+ 6 - 14
src/features/trackTimeDuration/hooks/RingData.tsx

@@ -139,9 +139,6 @@ export const getTarget = (data: any, isBigRing: boolean) => {
         }
         else {
             var timestamp = data.fast.target_start_time
-            // if (data.fast.real_start_time_zone) {
-            //     timestamp = TimeFormatter.transferTimestamp(timestamp, data.fast.real_start_time_zone)
-            // }
             targetRingBig.color = (global.fastColor ? global.fastColor : ColorType.fast) + '66'
             targetRingBig.startArc = startArc(timestamp)
             targetRingBig.durationArc = durationArc(data.fast.target_start_time, data.fast.target_end_time)
@@ -150,9 +147,6 @@ export const getTarget = (data: any, isBigRing: boolean) => {
     }
     else {
         var timestamp = data.sleep.target_start_time
-        // if (data.sleep.real_start_time_zone) {
-        //     timestamp = TimeFormatter.transferTimestamp(timestamp, data.sleep.real_start_time_zone)
-        // }
         targetRingSmall.startArc = startArc(timestamp)
         targetRingSmall.durationArc = durationArc(data.sleep.target_start_time, data.sleep.target_end_time)
         return targetRingSmall
@@ -313,8 +307,8 @@ export const getReal = (data: any, isBigRing: boolean, isRecord: boolean) => {
     if (isBigRing) {
         if (data.scenario == 'SLEEP') {
             realRingBig.color = global.sleepColor ? global.sleepColor : ColorType.sleep
-            if (data.sleep.real_end_time_zone && data.status == 'COMPLETED') {
-                var timestamp = TimeFormatter.transferTimestamp(data.sleep.real_start_time, data.sleep.real_end_time_zone)
+            if (data.sleep.real_end_timezone && data.sleep.real_end_timezone.gmt && data.status == 'COMPLETED') {
+                var timestamp = TimeFormatter.transferTimestamp(data.sleep.real_start_time, data.sleep.real_end_timezone.gmt)
                 realRingBig.startArc = startArc(timestamp)
             }
             else {
@@ -324,8 +318,8 @@ export const getReal = (data: any, isBigRing: boolean, isRecord: boolean) => {
             realRingBig.durationArc = durationArc(data.sleep.real_start_time, isRecord ? (data.sleep.real_end_time ? data.sleep.real_end_time : new Date().getTime()) : new Date().getTime())
         }
         else {
-            if (data.fast.real_end_time_zone && data.status == 'COMPLETED') {
-                var timestamp = TimeFormatter.transferTimestamp(data.fast.real_start_time, data.fast.real_end_time_zone)
+            if (data.fast.real_end_timezone.gmt && data.status == 'COMPLETED') {
+                var timestamp = TimeFormatter.transferTimestamp(data.fast.real_start_time, data.fast.real_end_timezone.gmt)
 
                 realRingBig.startArc = startArc(timestamp)
             }
@@ -341,10 +335,8 @@ export const getReal = (data: any, isBigRing: boolean, isRecord: boolean) => {
         if (!data.sleep) {
             return realRingSmall
         }
-        if (data.sleep.real_end_time_zone && data.status == 'COMPLETED') {
-            // alert(data.fast.real_end_time_zone)
-            var timestamp = TimeFormatter.transferTimestamp(data.sleep.real_start_time, data.fast.real_end_time_zone ? data.fast.real_end_time_zone : data.sleep.real_end_time_zone)
-            // alert(timestamp)
+        if (data.sleep.real_end_timezone && data.sleep.real_end_timezone.gmt && data.status == 'COMPLETED') {
+            var timestamp = TimeFormatter.transferTimestamp(data.sleep.real_start_time, data.fast.real_end_timezone.gmt ? data.fast.real_end_timezone.gmt : data.sleep.real_end_timezone.gmt)
             realRingSmall.startArc = startArc(timestamp)
         }
         else {