宽窄优行-由【嘉易行】项目成品而来
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
//  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
 
/// There may come a need, say when you are making a scheduling app, when
/// it might be good to know how two time periods relate to one another
/// Are they the same? Is one inside of another?
/// All these questions may be asked using the relationship method of TimePeriod.
public enum TimePeriodRelation {
    case after
    case startTouching
    case startInside
    case insideStartTouching
    case enclosingStartTouching
    case enclosing
    case enclosingEndTouching
    case exactMatch
    case inside
    case insideEndTouching
    case endInside
    case endTouching
    case before
    case none
}
 
/// Whether the time period is Open or Closed
///
/// - open: The boundary moment of time is included in calculations.
/// - closed: The boundary moment of time represents a boundary value which is excluded in regard to calculations.
public enum IntervalType {
    case open
    case closed
}
 
/// When a time periods is lengthened or shortened, it does so anchoring one date
/// of the time period and then changing the other one. There is also an option to
/// anchor the centerpoint of the time period, changing both the start and end dates.
public enum TimePeriodAnchor {
    case beginning
    case center
    case end
}