宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-04-06 a1ae6802080a22e6e6ce6d0935e95facb1daca5c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
//  SwiftDate
//  Parse, validate, manipulate, and display dates, time and timezones in Swift
//
//  Created by Daniele Margutti
//   - Web: https://www.danielemargutti.com
//   - Twitter: https://twitter.com/danielemargutti
//   - Mail: hello@danielemargutti.com
//
//  Copyright © 2019 Daniele Margutti. Licensed under MIT License.
//
 
import Foundation
 
public struct SwiftDate {
 
    private init() { }
 
    /// The default region is used to manipulate and work with plain `Date` object and
    /// wherever a region parameter is optional. By default region is the to GMT timezone
    /// along with the default device's locale and calendar (both autoupdating).
    public static var defaultRegion = Region.UTC
 
    /// This is the ordered list of all formats SwiftDate can use in order to attempt parsing a passaed
    /// date expressed as string. Evaluation is made in order; you can add or remove new formats as you wish.
    /// In order to reset the list call `resetAutoFormats()` function.
    public static var autoFormats: [String] {
        set { DateFormats.autoFormats = newValue }
        get { return DateFormats.autoFormats }
    }
 
    /// Reset the list of all built-in auto formats patterns.
    public static func resetAutoFormats() {
        DateFormats.resetAutoFormats()
    }
}