setInitialTime method
void
setInitialTime()
Implementation
void setInitialTime() {
var startTime = DateTime(dateStart[0], dateStart[1], dateStart[2], 0, 0, 0);
var endTime = DateTime(dateEnd[0], dateEnd[1], dateEnd[2], 0, 0, 0);
if (dateInitial != null) {
initialTime = DateTime(dateInitial![0], dateInitial![1], dateInitial![2], 0, 0, 0);
if (initialTime.isBefore(startTime)) {
initialTime = startTime;
} else if (initialTime.isAfter(endTime)) {
initialTime = endTime;
}
return;
}
var now = DateTime.now();
if (now.isBefore(startTime)) {
initialTime = DateTime(dateStart[0], dateStart[1], dateStart[2], now.hour,
now.minute, now.second);
} else if (now.isAfter(endTime)) {
initialTime = DateTime(
dateEnd[0], dateEnd[1], dateEnd[2], now.hour, now.minute, now.second);
} else {
initialTime = now;
}
}