|
|
@@ -8,7 +8,7 @@ import { useEffect, useState } from "react";
|
|
|
import { useSelector } from "react-redux";
|
|
|
import './TimelineFastSleep.scss'
|
|
|
import dayjs from 'dayjs'
|
|
|
-import { rpxToPx } from "@/utils/tools";
|
|
|
+import { getTimezone, getTimezoneName, rpxToPx } from "@/utils/tools";
|
|
|
import Taro from "@tarojs/taro";
|
|
|
|
|
|
|
|
|
@@ -297,26 +297,31 @@ export default function TimelineFastSleep(props: {
|
|
|
}
|
|
|
|
|
|
function getTZLocation() {
|
|
|
+ /*
|
|
|
+ var name = props.authInfo.timezone
|
|
|
+ if (props.authInfo.timezone_name) {
|
|
|
+ name = `${name} (${props.authInfo.timezone_name})`
|
|
|
+ }
|
|
|
+ return name
|
|
|
+ */
|
|
|
if (props.data.fast) {
|
|
|
- if (props.data.fast.real_start_time_zone_id) {
|
|
|
- return `${dayjs().tz(props.data.fast.real_start_time_zone_id).format('z')} (${props.data.fast.real_start_time_zone_id})`
|
|
|
+ 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})`
|
|
|
}
|
|
|
- return props.data.fast.real_start_time_zone
|
|
|
+ return name
|
|
|
}
|
|
|
else {
|
|
|
- if (props.data.sleep.real_start_time_zone_id) {
|
|
|
- return `${dayjs().tz(props.data.sleep.real_start_time_zone_id).format('z')} (${props.data.sleep.real_start_time_zone_id})`
|
|
|
- // return props.data.sleep.real_start_time_zone_id
|
|
|
+ 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})`
|
|
|
}
|
|
|
- return props.data.sleep.real_start_time_zone
|
|
|
+ return name
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- function getDeviceLocation(){
|
|
|
- if (Taro.getSystemInfoSync().platform == 'ios') {
|
|
|
- return `${dayjs().format('z')} (${dayjs.tz.guess()})`
|
|
|
- }
|
|
|
- return `${dayjs().format('z')}`
|
|
|
+ function getDeviceLocation() {
|
|
|
+ return `${getTimezone()} (${getTimezoneName()})`
|
|
|
}
|
|
|
|
|
|
function getTZOffset() {
|
|
|
@@ -370,10 +375,10 @@ export default function TimelineFastSleep(props: {
|
|
|
</View>
|
|
|
</View>
|
|
|
{
|
|
|
- multTimeZone && <Text className="tz_note_desc" style={{width:rpxToPx(538)}}>{t('feature.common.multi_tz_desc')}</Text>
|
|
|
+ multTimeZone && <Text className="tz_note_desc" style={{ width: rpxToPx(538) }}>{t('feature.common.multi_tz_desc')}</Text>
|
|
|
}
|
|
|
{
|
|
|
- !multTimeZone && diffTimeZone && <Text className="tz_note_desc" style={{width:rpxToPx(538)}}>{t('feature.common.diff_tz_desc', { location: getTZLocation(), offset: getTZOffset(),device_location:getDeviceLocation() })}</Text>
|
|
|
+ !multTimeZone && diffTimeZone && <Text className="tz_note_desc" style={{ width: rpxToPx(538) }}>{t('feature.common.diff_tz_desc', { location: getTZLocation(), offset: getTZOffset(), device_location: getDeviceLocation() })}</Text>
|
|
|
}
|
|
|
</View>
|
|
|
}
|