From ba0ede1b9b7c88876d9df4c7456b0db7e9ded698 Mon Sep 17 00:00:00 2001 From: Kevin G Christiano Date: Wed, 29 Jul 2020 09:50:18 -0400 Subject: [PATCH] just date --- .../TextFields/DateDropdownEntryFieldModel.swift | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift index 70c357db..e0ae4a02 100644 --- a/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift +++ b/MVMCoreUI/Atomic/Atoms/FormFields/TextFields/DateDropdownEntryFieldModel.swift @@ -41,7 +41,6 @@ private enum CodingKeys: String, CodingKey { case date case dateFormat - case initialDate case minDate case maxDate } @@ -59,8 +58,9 @@ dateFormatter.dateFormat = dateFormat } - if let initialDate = try typeContainer.decodeIfPresent(String.self, forKey: .initialDate) { - self.initialDate = dateFormatter.date(from: initialDate) + if let date = try typeContainer.decodeIfPresent(String.self, forKey: .date) { + baseValue = date + self.date = dateFormatter.date(from: date) } if let minDate = try typeContainer.decodeIfPresent(String.self, forKey: .minDate) { @@ -76,10 +76,9 @@ try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(dateFormat, forKey: .dateFormat) - try container.encodeIfPresent(date, forKey: .date) - if let initialDate = initialDate { - try container.encode(dateFormatter.string(from: initialDate), forKey: .initialDate) + if let date = date { + try container.encode(dateFormatter.string(from: date), forKey: .date) } if let minDate = minDate {