just date
This commit is contained in:
parent
ca9afeef5d
commit
ba0ede1b9b
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user