Browse Source

fix wrong execute date

master
daivph 5 years ago
parent
commit
f0c7d5c6b1
3 changed files with 9 additions and 36 deletions
  1. +3
    -12
      lib/presentation/screens/actions/crop_status/sc_edit_action_crop_status.dart
  2. +3
    -12
      lib/presentation/screens/actions/environment_update/sc_edit_action_environment_update.dart
  3. +3
    -12
      lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart

+ 3
- 12
lib/presentation/screens/actions/crop_status/sc_edit_action_crop_status.dart View File

void initState() { void initState() {
super.initState(); super.initState();
changeFileController.initValue(); changeFileController.initValue();
//UPDATE
if (_cropStatus != null) {
try {
executeTime = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
.parse(_cropStatus.executeDate);
} catch (_) {}
} else {
//ADD NEW
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_cropStatus.executeDate = "$parsedExecuteDate";
}
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_cropStatus.executeDate = "$parsedExecuteDate";
executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime);
_cropStatus.cropId = widget.cropId; _cropStatus.cropId = widget.cropId;
} }

+ 3
- 12
lib/presentation/screens/actions/environment_update/sc_edit_action_environment_update.dart View File

void initState() { void initState() {
super.initState(); super.initState();
changeFileController.initValue(); changeFileController.initValue();
//UPDATE
if (_environment != null) {
try {
executeTime = DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
.parse(_environment.executeDate);
} catch (_) {}
} else {
//ADD NEW
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_environment.executeDate = "$parsedExecuteDate";
}
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_environment.executeDate = "$parsedExecuteDate";
executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime);
_environment.cropId = widget.cropId; _environment.cropId = widget.cropId;
} }

+ 3
- 12
lib/presentation/screens/actions/nursery/sc_edit_action_nursery.dart View File

changeSupply.initValue(); changeSupply.initValue();
changeFileController.initValue(); changeFileController.initValue();
_nursery.nurseryDetail = new List<NurseryDetail>(); _nursery.nurseryDetail = new List<NurseryDetail>();
//UPDATE
if (_nursery.id != null) {
try {
executeTime =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(_nursery.executeDate);
} catch (_) {}
} else {
//ADD NEW
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_nursery.executeDate = "$parsedExecuteDate";
}
var parsedExecuteDate =
DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").format(executeTime);
_nursery.executeDate = "$parsedExecuteDate";
executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime); executeTimeView = DateFormat("dd/MM/yyyy HH:mm").format(executeTime);
_nursery.cropId = widget.cropId; _nursery.cropId = widget.cropId;
} }

Loading…
Cancel
Save