@@ -89,6 +89,8 @@ public struct DateTime: Val {
8989 }
9090 }
9191
92+ /// Converts to Zinc formatted string.
93+ /// See [Zinc Literals](https://project-haystack.org/doc/docHaystack/Zinc#literals)
9294 public func toZinc( ) -> String {
9395 var zinc : String
9496 if hasMilliseconds {
@@ -166,14 +168,6 @@ public struct DateTime: Val {
166168 }
167169
168170 return ( date, gmtOffset)
169-
170- // if let date = dateTimeFormatter.date(from: isoString) {
171- // return date
172- // } else if let date = dateTimeWithMillisFormatter.date(from: isoString) {
173- // return date
174- // } else {
175- // throw ValError.invalidDateTimeFormat(isoString)
176- // }
177171 }
178172
179173 private var hasMilliseconds : Bool {
@@ -199,7 +193,6 @@ public struct DateTime: Val {
199193
200194var calendar = Calendar ( identifier: . gregorian)
201195
202- /// See https://project-haystack.org/doc/docHaystack/Json#dateTime
203196extension DateTime {
204197 static let kindValue = " dateTime "
205198
@@ -209,6 +202,8 @@ extension DateTime {
209202 case tz
210203 }
211204
205+ /// Read from decodable data
206+ /// See [JSON format](https://project-haystack.org/doc/docHaystack/Json#dateTime)
212207 public init ( from decoder: Decoder ) throws {
213208 guard let container = try ? decoder. container ( keyedBy: Self . CodingKeys) else {
214209 throw DecodingError . typeMismatch (
@@ -249,6 +244,8 @@ extension DateTime {
249244 self . timezone = timezone
250245 }
251246
247+ /// Write to encodable data
248+ /// See [JSON format](https://project-haystack.org/doc/docHaystack/Json#dateTime)
252249 public func encode( to encoder: Encoder ) throws {
253250 var container = encoder. container ( keyedBy: Self . CodingKeys)
254251 try container. encode ( Self . kindValue, forKey: . _kind)
0 commit comments