|
|
@@ -57,6 +57,15 @@ export default function SetGoal() {
|
|
|
setFastDuration(str)
|
|
|
}
|
|
|
|
|
|
+ function getFastDurationMinutes(){
|
|
|
+ var obj = target.fast.schedule.fast
|
|
|
+ var duration = obj.end_time.split(':')[0] * 60 + obj.end_time.split(':')[1] * 1 - (obj.start_time.split(':')[0] * 60 + obj.start_time.split(':')[1] * 1)
|
|
|
+ if (duration <= 0) {
|
|
|
+ duration += 24 * 60
|
|
|
+ }
|
|
|
+ return duration
|
|
|
+ }
|
|
|
+
|
|
|
function getSleepDuration() {
|
|
|
var obj = target.sleep.schedule.sleep
|
|
|
var duration = obj.end_time.split(':')[0] * 60 + obj.end_time.split(':')[1] * 1 - (obj.start_time.split(':')[0] * 60 + obj.start_time.split(':')[1] * 1)
|
|
|
@@ -69,6 +78,15 @@ export default function SetGoal() {
|
|
|
setSleepDuration(str)
|
|
|
}
|
|
|
|
|
|
+ function getSleepDurationMinutes(){
|
|
|
+ var obj = target.sleep.schedule.sleep
|
|
|
+ var duration = obj.end_time.split(':')[0] * 60 + obj.end_time.split(':')[1] * 1 - (obj.start_time.split(':')[0] * 60 + obj.start_time.split(':')[1] * 1)
|
|
|
+ if (duration <= 0) {
|
|
|
+ duration += 24 * 60
|
|
|
+ }
|
|
|
+ return duration
|
|
|
+ }
|
|
|
+
|
|
|
function hidePicker() {
|
|
|
setShowTimePicker(false)
|
|
|
}
|
|
|
@@ -166,7 +184,7 @@ export default function SetGoal() {
|
|
|
start_time: fastTarget.start_time,
|
|
|
end_time: fastTarget.end_time,
|
|
|
duration: {
|
|
|
- input_value: target.fast.schedule.fast.duration.init_value,
|
|
|
+ input_value: getFastDurationMinutes()//target.fast.schedule.fast.duration.init_value,
|
|
|
}
|
|
|
},
|
|
|
}
|
|
|
@@ -176,7 +194,9 @@ export default function SetGoal() {
|
|
|
params.schedule.sleep = {
|
|
|
start_time: sleepTarget.start_time,
|
|
|
end_time: sleepTarget.end_time,
|
|
|
-
|
|
|
+ duration:{
|
|
|
+ input_value:getSleepDurationMinutes()
|
|
|
+ },
|
|
|
latency: {
|
|
|
input_value: target.sleep.schedule.sleep.latency.init_value,
|
|
|
},
|