Fix the date format in intervention_medication_view_model

merge-requests/953/head
RoaaGhali98 4 years ago
parent 0895a80d16
commit d3f0f1a141

@ -49,12 +49,8 @@ class InterventionMedicationViewModel extends BaseViewModel {
InterventionMedicationReqModel( InterventionMedicationReqModel(
projectID: projectId, projectID: projectId,
patientID: patientId, patientID: patientId,
fromDate: AppDateUtils.convertToServerFormat( fromDate: AppDateUtils.convertDateToServerFormat(fromDate),
fromDate.toString(), toDate: AppDateUtils.convertDateToServerFormat(toDate),
'MM/dd/yyyy'),
toDate: AppDateUtils.convertToServerFormat(
toDate.toString(),
'MM/dd/yyyy'),
); );
hasError = false; hasError = false;
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);

@ -28,6 +28,10 @@ class AppDateUtils {
return '/Date(${DateFormat(dateFormat).parse(date).millisecondsSinceEpoch})/'; return '/Date(${DateFormat(dateFormat).parse(date).millisecondsSinceEpoch})/';
} }
static String convertDateToServerFormat(DateTime date) {
return '/Date(${date.millisecondsSinceEpoch})/';
}
static convertDateFromServerFormat(String str, dateFormat) { static convertDateFromServerFormat(String str, dateFormat) {
var date = getDateTimeFromServerFormat(str); var date = getDateTimeFromServerFormat(str);

Loading…
Cancel
Save