Skip to content
Snippets Groups Projects
Commit 8afbaa48 authored by Julia Friesel's avatar Julia Friesel
Browse files

Only activate save button when time is a valid one

parent ce87dda0
No related branches found
No related tags found
No related merge requests found
...@@ -80,16 +80,21 @@ export default class Temp extends Component { ...@@ -80,16 +80,21 @@ export default class Temp extends Component {
exclude: this.state.exclude, exclude: this.state.exclude,
time: this.state.time time: this.state.time
} }
if (!cycleDay.temperature || cycleDay.temperature && !cycleDay.temperature.time) {
const now = LocalTime.now().truncatedTo(ChronoUnit.MINUTES).toString()
dataToSave.time = now
}
saveSymptom('temperature', cycleDay, dataToSave) saveSymptom('temperature', cycleDay, dataToSave)
}, },
saveDisabled: this.state.currentValue === '' saveDisabled: this.state.currentValue === '' || isInvalidTime(this.state.time)
})} })}
</View> </View>
</View> </View>
) )
} }
} }
function isInvalidTime(timeString) {
try {
LocalTime.parse(timeString)
} catch (err) {
return true
}
return false
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment