Leon 1 year ago
parent
commit
03342defc7

+ 8 - 3
src/context/locales/en.js

@@ -215,8 +215,8 @@ export default {
             overview: 'Overview',
             events: 'Events',
             stages: 'Stages',
-            get_local_time: 'Show local nighttime',
-            get_local_time_sunrise: 'Show local daytime',
+            get_local_time: 'Show my local nighttime',
+            get_local_time_sunrise: 'Show my local daytime',
             to:' to ',
             note:'Note',
             night_tip:'Times displayed represent global annual averages for sunset and sunrise. Actual times vary based on your location and season.',
@@ -232,7 +232,12 @@ export default {
             night_alert_title:'Night Ring On',
             night_alert_content:'Log in and check out your local nighttime hours spanning from sunset to sunrise.',
             day_alert_title:'Day Ring On',
-            day_alert_content:'Log in and check out your local daytime hours spanning from sunrise to sunset.'
+            day_alert_content:'Log in and check out your local daytime hours spanning from sunrise to sunset.',
+            location_need:'Location needed',
+            location_need_content_day:'To accurately calculate local daytime from sunrise to sunset, which  please pick your location.',
+            location_need_content_night:'To accurately calculate local nighttime from sunset to sunrise, please pick your location.',
+            later:'Later',
+            picker_now:'Pick now'
         },
         track_time_duration: {
             common: {

+ 8 - 3
src/context/locales/zh.js

@@ -220,8 +220,8 @@ export default {
             overview: '概览',
             events: '事件',
             stages: '阶段',
-            get_local_time: '显示当地夜晚时间',
-            get_local_time_sunrise: '显示当地白天时间',
+            get_local_time: '显示我本地的夜晚时间',
+            get_local_time_sunrise: '显示我本地的白天时间',
             to: '至',
             note: '提示',
             night_tip:'当前显示时间为全球各地年均日落日出时间;\n实际时间根据您所在地理位置和季节有所变化。',
@@ -237,7 +237,12 @@ export default {
             night_alert_title: '夜间环已开启',
             night_alert_content: '登录后, 您可以查看当地夜间时段 (日落至日出)。',
             day_alert_title: '白天环已开启',
-            day_alert_content: '登录后, 您可以查看当地白天时段 (日出至日落)。'
+            day_alert_content: '登录后, 您可以查看当地白天时段 (日出至日落)。',
+            location_need:'需要位置',
+            location_need_content_day:'为准确计算本地白天时间(日落至日出), 请选择您所在位置。',
+            location_need_content_night:'为准确计算本地夜晚时间(日出至日落), 请选择您所在位置。',
+            later:'稍后',
+            picker_now:'立即选择'
         },
         track_time_duration: {
             common: {

+ 9 - 1
src/features/trackTimeDuration/components/AllDayRings.tsx

@@ -259,7 +259,12 @@ export default function AllDayRings(props: { schedule: any }) {
             durationArc: 2
         }
 
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
+        var now = new Date().getTime()
+        if (authInfo && authInfo.timezone) {
+            now = TimeFormatter.transferTimestamp(now, authInfo.timezone)
+        }
+
+        if (authInfo && authInfo.day_completed && now > authInfo.day_completed.sunset_ts) {
             realRingBig.color = ColorType.day
             var duration = (authInfo.day_completed.sunset_ts - authInfo.day_completed.sunrise_ts) / 1000
             // var start = new Date(authInfo.day_completed.sunrise_ts)
@@ -288,6 +293,9 @@ export default function AllDayRings(props: { schedule: any }) {
         realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
 
         var currentDot = getDot(null, false)
+        if (authInfo && authInfo.timezone){
+            currentDot.offset = TimeFormatter.timeZoneOffset(authInfo.timezone)
+        }
         var date = new Date()
         var minutes = date.getHours() * 60 + date.getMinutes()
         if (minutes < sunRise) {

+ 9 - 1
src/features/trackTimeDuration/components/AllRings.tsx

@@ -202,8 +202,13 @@ export default function AllRings(props: { data?: any, time?: any }) {
             durationArc: 2
         }
 
+        var now = new Date().getTime()
+        if (authInfo && authInfo.timezone) {
+            now = TimeFormatter.transferTimestamp(now, authInfo.timezone)
+        }
+
 
-        if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
+        if (authInfo && authInfo.night_completed && now > authInfo.night_completed.sunrise_ts) {
             realRingBig.color = ColorType.night
             var duration = (authInfo.night_completed.sunrise_ts - authInfo.night_completed.sunset_ts) / 1000
             // var start = new Date(authInfo.night_completed.sunset_ts)
@@ -231,6 +236,9 @@ export default function AllRings(props: { data?: any, time?: any }) {
         realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
 
         var currentDot = getDot(null, false)
+        if (authInfo && authInfo.timezone) {
+            currentDot.offset = TimeFormatter.timeZoneOffset(authInfo.timezone)
+        }
         currentDot.color = ColorType.night
 
         var now = new Date()

+ 55 - 27
src/features/trackTimeDuration/components/DayNightCard.tsx

@@ -60,7 +60,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
     const [sunriseDate, setSunriseDate] = useState<any>(sunriseA)
     const [sunriseTmrDate, setSunriseTmrDate] = useState<any>(new Date(sunriseB.getTime() + 24 * 3600 * 1000))
     const [sunsetDate, setSunsetDate] = useState<any>(sunsetA)
-    const [status,setStatus] = useState('')
+    const [status, setStatus] = useState('')
 
 
     const [showDetailModal, setShowDetailModal] = useState(false)
@@ -254,7 +254,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                     setSunriseTmrTime(data.daylights[1].sunrise)
                     setSunsetDate(yesterdayDate)
                     setSunriseTmrDate(todaySunriseDate)
-        
+
 
                 }
                 else {
@@ -277,14 +277,14 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                     setSunriseTmrTime(data.daylights[2].sunrise)
                     setSunsetDate(todaySunsetDate)
                     setSunriseTmrDate(tomorrowSunriseDate)
-      
+
                 }
                 else {
                     setSunriseTime(data.daylights[1].sunrise)
                     setSunsetTime(data.daylights[1].sunset)
                     setSunsetDate(todaySunsetDate)
                     setSunriseDate(todaySunriseDate)
-   
+
                 }
                 updateNightStore(today, data.daylights[2].sunrise, data.daylights[1].sunset)
                 updateDayStore(today, data.daylights[1].sunrise, data.daylights[1].sunset)
@@ -298,14 +298,14 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                     setSunriseTmrTime(data.daylights[2].sunrise)
                     setSunsetDate(todaySunsetDate)
                     setSunriseTmrDate(tomorrowSunriseDate)
-        
+
                 }
                 else {
                     setSunriseTime(data.daylights[2].sunrise)
                     setSunsetTime(data.daylights[2].sunset)
                     setSunriseDate(tomorrowSunriseDate)
                     setSunsetDate(tomorrowSunsetDate)
-    
+
                 }
                 updateNightStore(todaySunsetDate, data.daylights[2].sunrise, data.daylights[1].sunset)
                 updateDayStore(tomorrowSunriseDate, data.daylights[2].sunrise, data.daylights[2].sunset)
@@ -398,8 +398,8 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
         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())}`
         // systemLocation({
-        //     lat: 77,
-        //     lng: 20,
+        //     lat: 25.55,
+        //     lng: -49.888,
         //     date_start: strYesterday,
         //     date_end: strTomorrow,
         //     coordinate_system_standard: 'GCJ-02'
@@ -956,12 +956,17 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
             durationArc: 2
         }
 
-        
-        if (authInfo && authInfo.night_completed && new Date().getTime() > authInfo.night_completed.sunrise_ts) {
+        var now1 = new Date().getTime()
+        if (authInfo && authInfo.timezone) {
+            now1 = TimeFormatter.transferTimestamp(now1, authInfo.timezone)
+        }
+
+
+        if (authInfo && authInfo.night_completed && now1 > authInfo.night_completed.sunrise_ts) {
             realRingBig.color = ColorType.night
             var duration = (authInfo.night_completed.sunrise_ts - authInfo.night_completed.sunset_ts) / 1000
             // var start = new Date(authInfo.night_completed.sunset_ts)
-            var newT = TimeFormatter.transferTimestamp(authInfo.night_completed.sunset_ts,authInfo.timezone)
+            var newT = TimeFormatter.transferTimestamp(authInfo.night_completed.sunset_ts, authInfo.timezone)
             var start = new Date(newT)
             realRingBig.startArc = (start.getHours() * 3600 + start.getMinutes() * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
             realRingBig.durationArc = (duration) / (24 * 3600) * 2 * Math.PI;
@@ -986,8 +991,11 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
 
         var currentDot = getDot(null, false)
         currentDot.color = ColorType.night
+        currentDot.offset = (authInfo && authInfo.timezone) ? TimeFormatter.timeZoneOffset(authInfo.timezone) : 0
 
         var now = new Date()
+        now = localNow(now)
+
         var t = now.getHours() * 60 + now.getMinutes()
         var duration2 = t - sunSet
         if (duration2 < 0) {
@@ -1001,7 +1009,6 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
 
         if (nightStore.nightRingDate) {
             if (new Date(nightStore.nightRingDate).getDate() == new Date().getDate() && new Date().getHours() < 12) {
-
                 realRing = null;
             }
         }
@@ -1016,6 +1023,13 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
 
     }
 
+    function localNow(now: Date) {
+        if (authInfo && authInfo.timezone) {
+            return new Date(TimeFormatter.transferTimestamp(now.getTime(), authInfo.timezone))
+        }
+        return now
+    }
+
     function dayRing() {
         var common = getCommon(null, true)
         common.radius = bigRingRadius;
@@ -1028,12 +1042,17 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
             durationArc: 2
         }
 
-        if (authInfo && authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
+        var now1 = new Date().getTime()
+        if (authInfo && authInfo.timezone) {
+            now1 = TimeFormatter.transferTimestamp(now1, authInfo.timezone)
+        }
+
+        if (authInfo && authInfo.day_completed && now1 > authInfo.day_completed.sunset_ts) {
             realRingBig.color = ColorType.day
             var duration = (authInfo.day_completed.sunset_ts - authInfo.day_completed.sunrise_ts) / 1000
             // var start = new Date(authInfo.day_completed.sunrise_ts)
             // var start = new Date(authInfo.night_completed.sunset_ts)
-            var newT = TimeFormatter.transferTimestamp(authInfo.day_completed.sunrise_ts,authInfo.timezone)
+            var newT = TimeFormatter.transferTimestamp(authInfo.day_completed.sunrise_ts, authInfo.timezone)
             var start = new Date(newT)
             realRingBig.startArc = (start.getHours() * 3600 + start.getMinutes() * 60) / (24 * 3600) * 2 * Math.PI - Math.PI / 2.0;
             realRingBig.durationArc = (duration) / (24 * 3600) * 2 * Math.PI;
@@ -1057,6 +1076,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
         realRingBig.durationArc = (duration * 60) / (24 * 3600) * 2 * Math.PI;
 
         var currentDot = getDot(null, false)
+        currentDot.offset = (authInfo && authInfo.timezone) ? TimeFormatter.timeZoneOffset(authInfo.timezone) : 0
         var date = new Date()
         var minutes = date.getHours() * 60 + date.getMinutes()
         if (minutes < sunRise) {
@@ -1099,10 +1119,11 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
         }
 
         var now = new Date()
+        now = localNow(now)
         if (props.isNight && sunsetDate) {
             if (now.getTime() > sunsetDate.getTime()) {
-                global.sunsetDuration = TimeFormatter.countdown(sunsetDate.getTime())
-                return TimeFormatter.countdown(sunsetDate.getTime())
+                global.sunsetDuration = TimeFormatter.countdown(sunsetDate.getTime(), now.getTime())
+                return TimeFormatter.countdown(sunsetDate.getTime(), now.getTime())
             }
             // return TimeFormatter.countdown(sunsetDate.getTime())
         }
@@ -1195,29 +1216,36 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
         return false
     }
 
-    function currentStatus(){
-        if (showArrow()){
-            return '过去'
+    function currentStatus() {
+        if (showArrow()) {
+            if (props.isNight) {
+                if (authInfo.day_completed && new Date().getTime() > authInfo.day_completed.sunset_ts) {
+                    return '更新暂停'
+                }
+                return '已结束'
+            }
+            return '更新暂停'
         }
-        var strTime = props.isNight?getSunsetDuration():getSunriseDuration()
-        return (strTime.indexOf('小时')!=-1||strTime.indexOf('分钟')!=-1)?'即将到来':'当前'
+        var strTime = props.isNight ? getSunsetDuration() : getSunriseDuration()
+        return (strTime.indexOf('小时') != -1 || strTime.indexOf('分钟') != -1) ? '即将到来' : '正在进行'
     }
 
     function footerDesc() {
         var now = new Date()
+        now = localNow(now)
         if (props.isNight) {
             if (now.getTime() < sunsetDate.getTime()) {
-                return '距日落' + TimeFormatter.countdown(sunsetDate.getTime())
+                return '距日落' + TimeFormatter.countdown(sunsetDate.getTime(), now.getTime())
 
             }
-            return '距日出' + TimeFormatter.countdown(sunriseTmrDate.getTime())
+            return '距日出' + TimeFormatter.countdown(sunriseTmrDate.getTime(), now.getTime())
         }
 
         if (now.getTime() > sunriseDate.getTime() && now.getTime() < sunsetDate.getTime()) {
 
-            return '距日落' + TimeFormatter.countdown(sunsetDate.getTime())
+            return '距日落' + TimeFormatter.countdown(sunsetDate.getTime(), now.getTime())
         }
-        return '距日出' + TimeFormatter.countdown(sunriseDate.getTime())
+        return '距日出' + TimeFormatter.countdown(sunriseDate.getTime(), now.getTime())
 
 
 
@@ -1280,7 +1308,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                             }
                         </View> */}
                         <View className='day_card_header'>
-                        <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>{currentStatus()}</View>
+                            <View className='free' style={{ backgroundColor: props.isNight ? ColorType.night : ColorType.day, color: props.isNight ? '#fff' : '#1C1C1C' }}>{currentStatus()}</View>
                         </View>
                         <View className='day_card_footer'>
                             <Text className='day_card_footer_date'>
@@ -1296,7 +1324,7 @@ export default function DayNightCard(props: { isNight: boolean, count: number })
                             }
 
                             {
-                                !showArrow() && <Text className='footer_desc_text' style={{ color: props.isNight?ColorType.night:ColorType.day,opacity:0.4 }}>{footerDesc()}</Text>
+                                !showArrow() && <Text className='footer_desc_text' style={{ color: props.isNight ? ColorType.night : ColorType.day, opacity: 0.4 }}>{footerDesc()}</Text>
                             }
                         </View>
                     </View>

+ 42 - 21
src/features/trackTimeDuration/components/DayNightDetailPopup.tsx

@@ -7,6 +7,7 @@ import { TimeFormatter } from '@/utils/time_format'
 import { useSelector } from 'react-redux'
 import { ColorType } from '@/context/themes/color'
 import Timeline from '@/components/view/Timeline'
+import Taro from '@tarojs/taro'
 
 export default function DayNightDetailPopup(props: {
     isNight: boolean,
@@ -118,17 +119,20 @@ export default function DayNightDetailPopup(props: {
 
     function timeCount() {
         var now = new Date()
+        if (diffTimeZone()){
+            now = new Date(TimeFormatter.transferTimestamp(now.getTime(),props.authInfo.timezone))
+        }
         if (props.isNight) {
             if (now.getTime() < props.sunriseTmrDate.getTime()) {
-                return TimeFormatter.countdown(props.sunsetDate.getTime())
+                return TimeFormatter.countdown(props.sunsetDate.getTime(),now.getTime())
             }
-            return TimeFormatter.countdown(props.sunsetDate.getTime())
+            return TimeFormatter.countdown(props.sunsetDate.getTime(),now.getTime())
         } else {
 
             if (now.getTime() < props.sunsetDate.getTime()) {
-                return TimeFormatter.countdown(props.sunriseDate.getTime())
+                return TimeFormatter.countdown(props.sunriseDate.getTime(),now.getTime())
             }
-            return TimeFormatter.countdown(props.sunriseTmrDate.getTime())
+            return TimeFormatter.countdown(props.sunriseTmrDate.getTime(),now.getTime())
 
 
         }
@@ -136,15 +140,18 @@ export default function DayNightDetailPopup(props: {
 
     function timeCount2() {
         var now = new Date()
+        if (diffTimeZone()){
+            now = new Date(TimeFormatter.transferTimestamp(now.getTime(),props.authInfo.timezone))
+        }
         if (props.isNight) {
 
             if (now.getTime() < props.sunsetDate.getTime()) {
-                return TimeFormatter.countdown(props.sunriseTmrDate.getTime())
+                return TimeFormatter.countdown(props.sunriseTmrDate.getTime(),now.getTime())
             }
-            return TimeFormatter.countdown(props.sunriseTmrDate.getTime())
+            return TimeFormatter.countdown(props.sunriseTmrDate.getTime(),now.getTime())
 
         } else {
-            return TimeFormatter.countdown(props.sunsetDate.getTime())
+            return TimeFormatter.countdown(props.sunsetDate.getTime(),now.getTime())
         }
     }
 
@@ -269,11 +276,11 @@ export default function DayNightDetailPopup(props: {
         // return `Tomorrow ${sunriseTime} - ${sunsetTime}`
     }
 
-    function diffTimeZone(){
-        if (props.authInfo && props.authInfo.timezone){
+    function diffTimeZone() {
+        if (props.authInfo && props.authInfo.timezone) {
             var split = new Date().toString().split(' ');
             var timeZoneFormatted = split[split.length - 2];
-            if (timeZoneFormatted!=props.authInfo.timezone){
+            if (timeZoneFormatted != props.authInfo.timezone) {
                 return true
             }
         }
@@ -291,7 +298,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日落',//list[0],
-                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT, true),
+                        content: diffTimeZone() ? TimeFormatter.dateTimeFormate2(newT) : TimeFormatter.dateTimeFormate(newT, true),
                         date: '',
                         color: ColorType.night
                     }
@@ -301,7 +308,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日出',//list[1],
-                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT2):TimeFormatter.dateTimeFormate(newT2, true),
+                        content: diffTimeZone() ? TimeFormatter.dateTimeFormate2(newT2) : TimeFormatter.dateTimeFormate(newT2, true),
                         date: '',
                         color: ColorType.night
                     }
@@ -314,7 +321,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: showExtraData() ? 'done' : 'padding',
                         title: '日落',//list[0],
-                        content: list[0] + ' ' + props.sunsetTime.substring(0,5),
+                        content: list[0] + ' ' + props.sunsetTime.substring(0, 5),
                         date: '',
                         color: ColorType.night
                     }
@@ -324,7 +331,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'padding',
                         title: '日出',//list[1],
-                        content: list[1] + ' ' + props.sunriseTmrTime.substring(0,5),
+                        content: list[1] + ' ' + props.sunriseTmrTime.substring(0, 5),
                         date: '',
                         color: ColorType.night
                     }
@@ -340,7 +347,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日落',//list[0],
-                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT, true),
+                        content: diffTimeZone() ? TimeFormatter.dateTimeFormate2(newT) : TimeFormatter.dateTimeFormate(newT, true),
                         date: '',
                         color: ColorType.day
                     }
@@ -350,7 +357,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'done',
                         title: '日出',//list[1],
-                        content: diffTimeZone()?TimeFormatter.dateTimeFormate2(newT):TimeFormatter.dateTimeFormate(newT2, true),
+                        content: diffTimeZone() ? TimeFormatter.dateTimeFormate2(newT) : TimeFormatter.dateTimeFormate(newT2, true),
                         date: '',
                         color: ColorType.day
                     }
@@ -361,7 +368,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: showExtraData() ? 'done' : 'padding',
                         title: '日出',//dayDurationDesc(),
-                        content: dayDurationDesc() + ' ' + props.sunriseTime.substring(0,5),
+                        content: dayDurationDesc() + ' ' + props.sunriseTime.substring(0, 5),
                         date: '',
                         color: ColorType.day
                     }
@@ -371,7 +378,7 @@ export default function DayNightDetailPopup(props: {
                     {
                         status: 'padding',
                         title: '日落',//dayDurationDesc(),
-                        content: dayDurationDesc() + ' ' + props.sunsetTime.substring(0,5),
+                        content: dayDurationDesc() + ' ' + props.sunsetTime.substring(0, 5),
                         date: '',
                         color: ColorType.day
                     }
@@ -440,10 +447,10 @@ export default function DayNightDetailPopup(props: {
             (props.authInfo && props.authInfo.lat) ?
                 <View style={{ display: 'flex', flexDirection: 'column' }}>
                     <Text className='day_night_pop_location'>{getLocation()}</Text>
-                    <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between',alignItems:'center' }}>
+                    <View style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center' }}>
                         <Text className='day_night_pop_desc'>{t('feature.track_time_duration.third_ring.base_location_desc')}</Text>
                         <View onClick={chooseLocation}>
-                            <Text className='day_night_pop_choose' style={{color:props.isNight?ColorType.night:ColorType.day}}>{t('feature.track_time_duration.third_ring.update_my_location')}</Text>
+                            <Text className='day_night_pop_choose' style={{ color: props.isNight ? ColorType.night : ColorType.day }}>{t('feature.track_time_duration.third_ring.update_my_location')}</Text>
                         </View>
                     </View>
                 </View> :
@@ -451,7 +458,21 @@ export default function DayNightDetailPopup(props: {
                     if (process.env.TARO_ENV == 'weapp') {
                         e.stopPropagation()
                     }
-                    props.updateLocation();
+                    // 
+                    Taro.showModal({
+                        title: t('feature.day_night.location_need'),
+                        content: props.isNight ? t('feature.day_night.location_need_content_night') : t('feature.day_night.location_need_content_day'),
+                        showCancel: true,
+                        cancelText: t('feature.day_night.later'),
+                        confirmText: t('feature.day_night.picker_now'),
+                        success: function (res) {
+                            if (res.confirm) {
+                                props.updateLocation();
+                            } else if (res.cancel) {
+                                console.log('用户点击取消')
+                            }
+                        }
+                    })
                 }}>{props.isNight ? t('feature.day_night.get_local_time') : t('feature.day_night.get_local_time_sunrise')}</View></View>
         }
 

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

@@ -17,6 +17,7 @@ export type CurrentDot = {
     lineWidth: number;
     borderColor: string;
     timestamp?:number;
+    offset?:number;
 }
 
 export type RealRing = {
@@ -222,6 +223,13 @@ export default function Rings(props: {
         if (props.currentDot) {
             var time = new Date();
             var seconds = time.getHours() * 3600 + time.getMinutes() * 60 + time.getSeconds();
+            seconds += props.currentDot.offset!*60
+            if (seconds>24*3600){
+                seconds -= 24*3600
+            }
+            else if (seconds<0){
+                seconds += 24*3600
+            }
             var arc = seconds / 86400 * 2 * Math.PI - Math.PI / 2.0;
             const radians = arc;//angle * Math.PI / 180; // 将角度转换为弧度
             const xPrime = center + r * Math.cos(radians);

+ 4 - 2
src/features/trackTimeDuration/hooks/RingData.tsx

@@ -67,13 +67,15 @@ export const getDot = (data: any, isBigRing: boolean) => {
     const currentDotBig: CurrentDot = {
         color: global.fastColor ? global.fastColor : ColorType.fast,
         lineWidth: 8,
-        borderColor: 'black'
+        borderColor: 'black',
+        offset:0
     }
 
     const currentDotSmall: CurrentDot = {
         color: global.sleepColor ? global.sleepColor : ColorType.sleep,
         lineWidth: 8,
-        borderColor: 'black'
+        borderColor: 'black',
+        offset:0
     }
 
     if (isBigRing) {

+ 3 - 5
src/pages/clock/Clock.tsx

@@ -163,16 +163,16 @@ export default function Page() {
         if (!user.isLogin) {
             return
         }
-        const showAlert = await getStorage('117alert') || false;
+        const showAlert = await getStorage('118alert') || false;
         if (!showAlert) {
             Taro.showModal({
                 title: '版本更新提示',
-                content: '【昼夜环】追踪每天日出日落时间;\n【周统计】查看每周断食和睡眠平均时长;\n【记录筛选】根据场景, 浏览历史记录',
+                content: '充足的断食与睡眠时长很重要。断食与睡眠的起止时间,对健康同样重要!\n鉴于此我们升级了:\n【日出日落☀️】更精准地计算您所在城市的日出日落时间;\n【昼夜计时⏱️】黑夜/白天实时进程, 每晚按时cue你断食和睡眠;\n【时长预估🤔】动态预估断食各阶段时长(断食与睡眠场景独享)',
                 showCancel: false,
                 confirmText: '我知道了'
             })
         }
-        Taro.setStorage({ key: '117alert', data: true })
+        Taro.setStorage({ key: '118alert', data: true })
 
     }
 
@@ -452,7 +452,6 @@ export default function Page() {
                     dispatch(changeFastDuration(data.fast.target_end_time - data.fast.target_start_time))
                 }
                 else if (data.status == 'ONGOING1') {
-                    debugger
                     dispatch(changeSleepDuration(data.sleep.target_end_time - data.sleep.target_start_time))
                 }
                 break;
@@ -462,7 +461,6 @@ export default function Page() {
 
     global.popScheduleAlert = (scenario, startTime) => {
         if (permission.wxPubFollow) {
-            debugger
             Taro.showModal({
                 title: t('feature.track_time_duration.reminders.schedule_title'),
                 content: scenario.name == 'FAST' ?

+ 14 - 0
src/utils/time_format.ts

@@ -23,6 +23,7 @@ export class TimeFormatter {
     if (timeZone) {
       var localOffset = date.getTimezoneOffset()
       var targetOffset = localOffset + TimeFormatter.convertGMTtoOffset(timeZone)
+      debugger
       // 计算目标时间值(毫秒数加上偏移量的毫秒数)
       var targetTime = date.getTime() + (targetOffset * 60 * 1000);
 
@@ -33,6 +34,19 @@ export class TimeFormatter {
     return timestamp
   }
 
+  static timeZoneOffset(timeZone: string) {
+    if (!timeZone || timeZone.length == 0) {
+      return 0
+    }
+    var date = new Date()
+
+    if (timeZone) {
+      var localOffset = date.getTimezoneOffset()
+      return localOffset + TimeFormatter.convertGMTtoOffset(timeZone)
+    }
+    return 0
+  }
+
   //格式化时间
   static formatTimestamp(timestamp: number): string {
     const currentDate = new Date();