summaryrefslogtreecommitdiff
path: root/Jel/Models/JellyfinDateFormatter.swift
diff options
context:
space:
mode:
authorShav Kinderlehrer <[email protected]>2024-02-21 12:20:24 -0500
committerShav Kinderlehrer <[email protected]>2024-02-21 12:20:24 -0500
commitce0be87c7f39e9763d835a685cb65eb38c7e68c3 (patch)
treea548887701d035f40923de1838317d213a8a2532 /Jel/Models/JellyfinDateFormatter.swift
parent53b079259556532569af3af0e3b15aa887adbfd4 (diff)
downloadjel-ce0be87c7f39e9763d835a685cb65eb38c7e68c3.tar.gz
jel-ce0be87c7f39e9763d835a685cb65eb38c7e68c3.zip
Cleanup + change SignInView to be a sheet
Diffstat (limited to 'Jel/Models/JellyfinDateFormatter.swift')
-rw-r--r--Jel/Models/JellyfinDateFormatter.swift33
1 files changed, 0 insertions, 33 deletions
diff --git a/Jel/Models/JellyfinDateFormatter.swift b/Jel/Models/JellyfinDateFormatter.swift
deleted file mode 100644
index 74b89d1..0000000
--- a/Jel/Models/JellyfinDateFormatter.swift
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-// JellyfinDateFormatter.swift
-// Jel
-//
-// Created by zerocool on 12/12/23.
-//
-
-import Foundation
-
-// from: https://stackoverflow.com/a/46458771
-extension Formatter {
- static let iso8601withFractionalSeconds: ISO8601DateFormatter = {
- let formatter = ISO8601DateFormatter()
- formatter.formatOptions = [.withInternetDateTime, .withFractionalSeconds]
- return formatter
- }()
- static let iso8601: ISO8601DateFormatter = {
- let formatter = ISO8601DateFormatter()
- formatter.formatOptions = [.withInternetDateTime]
- return formatter
- }()
-}
-
-extension JSONDecoder.DateDecodingStrategy {
- static let iso8601withFractionalSeconds = custom {
- let container = try $0.singleValueContainer()
- let string = try container.decode(String.self)
- if let date = Formatter.iso8601withFractionalSeconds.date(from: string) ?? Formatter.iso8601.date(from: string) {
- return date
- }
- throw DecodingError.dataCorruptedError(in: container, debugDescription: "Invalid date: \(string)")
- }
-}