From aca223c7003182a2f1c87d2c4e33ccd7fc1e27df Mon Sep 17 00:00:00 2001 From: Sultan khan <> Date: Wed, 12 Jul 2023 14:44:53 +0300 Subject: [PATCH] business trip fixed --- lib/app_state/app_state.dart | 2 +- lib/classes/utils.dart | 10 ++++++++ .../dynamic_screens/dynamic_input_screen.dart | 23 +++++++++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/lib/app_state/app_state.dart b/lib/app_state/app_state.dart index b065816..45ec0a4 100644 --- a/lib/app_state/app_state.dart +++ b/lib/app_state/app_state.dart @@ -90,7 +90,7 @@ class AppState { String get getHuaweiPushToken => _huaweiPushToken; - final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 33, versionID: 4.6, mobileType: Platform.isAndroid ? "android" : "ios"); + final PostParamsModel _postParamsInitConfig = PostParamsModel(channel: 31, versionID: 4.6, mobileType: Platform.isAndroid ? "android" : "ios"); void setPostParamsInitConfig() { isAuthenticated = false; diff --git a/lib/classes/utils.dart b/lib/classes/utils.dart index 34831c2..9c55375 100644 --- a/lib/classes/utils.dart +++ b/lib/classes/utils.dart @@ -401,4 +401,14 @@ class Utils { } return false; } + static bool isDate(String input, String format) { + try { + DateTime d = DateFormat(format).parseStrict(input); + //print(d); + return true; + } catch (e) { + //print(e); + return false; + } + } } diff --git a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart index a6ffcf1..b780589 100644 --- a/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart +++ b/lib/ui/my_attendance/dynamic_screens/dynamic_input_screen.dart @@ -339,12 +339,27 @@ class _DynamicInputScreenState extends State { } idColName = val; + // if (getEitDffStructureList![j].fORMATTYPE == "X") { + // idColName = Utils.formatDateDefault(idColName!); + // // commenting to test + // // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); + // // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); + // + // } if (getEitDffStructureList![j].fORMATTYPE == "X") { - idColName = Utils.formatDateDefault(idColName!); - // commenting to test - // DateTime date = DateFormat('yyyy-MM-dd').parse(idColName!); - // idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); + idColName = Utils.reverseFormatDate(idColName!); + if(Utils.isDate(Utils.reverseFormatDate(Utils.formatDateNew(idColName!)), "yyyy-MM-dd")){ + idColName = Utils.formatStandardDate(Utils.formatStandardDate(Utils.formatDateNew(idColName!))); + // idColName = DateFormat('yyyy/MM/dd HH:mm:ss').format(date); + }else if(Utils.isDate(Utils.reverseFormatDate(idColName!), "dd-MM-yyyy")){ + + + // // change date format on 31/05/2023 + DateTime date = DateFormat('dd-MM-yyyy').parse(idColName!); + idColName = DateFormat('yyyy-MM-dd HH:mm:ss').format(date); + + } } }