diff --git a/Sources/ReerJSON/JSONDecoderImpl.swift b/Sources/ReerJSON/JSONDecoderImpl.swift index b28cb01..0235414 100644 --- a/Sources/ReerJSON/JSONDecoderImpl.swift +++ b/Sources/ReerJSON/JSONDecoderImpl.swift @@ -267,6 +267,7 @@ final class JSONDecoderImpl: Decoder { )) } return date + #if !os(Linux) case .formatted(let formatter): let string = try unboxString(from: value, for: codingPathNode, additionalKey) guard let date = formatter.date(from: string) else { @@ -276,6 +277,7 @@ final class JSONDecoderImpl: Decoder { )) } return date + #endif case .custom(let closure): return try with(value: value, path: codingPathNode.appending(additionalKey)) { try closure(self) diff --git a/Sources/ReerJSON/JSONEncoderImpl.swift b/Sources/ReerJSON/JSONEncoderImpl.swift index 87a3368..16ae041 100644 --- a/Sources/ReerJSON/JSONEncoderImpl.swift +++ b/Sources/ReerJSON/JSONEncoderImpl.swift @@ -283,8 +283,10 @@ class JSONEncoderImpl: Encoder { return try wrapFloat(1000.0 * date.timeIntervalSince1970, for: additionalKey) case .iso8601: return wrapString(_iso8601Formatter.string(from: date)) + #if !os(Linux) case .formatted(let formatter): return wrapString(formatter.string(from: date)) + #endif case .custom(let closure): return try _encodeNestedValue(for: additionalKey) { try closure(date, self) } ?? yyjson_mut_obj(doc) @unknown default: fatalError()