라이브 시작시간 UTC 적용
라이브 상세와 수정 화면에서 UTC 기준 시간을 표시한다. 날짜 표기는 OS 언어 설정의 기본 포맷을 사용한다.
This commit is contained in:
@@ -15,6 +15,16 @@ extension Date {
|
||||
return formatter.string(from: self)
|
||||
}
|
||||
|
||||
func localizedDateTimeString(dateStyle: DateFormatter.Style = .medium,
|
||||
timeStyle: DateFormatter.Style = .short) -> String {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateStyle = dateStyle
|
||||
formatter.timeStyle = timeStyle
|
||||
formatter.locale = Locale.autoupdatingCurrent
|
||||
formatter.timeZone = TimeZone.current
|
||||
return formatter.string(from: self)
|
||||
}
|
||||
|
||||
func currentTimeMillis() -> Int64 {
|
||||
return Int64(self.timeIntervalSince1970 * 1000)
|
||||
}
|
||||
|
||||
@@ -95,4 +95,12 @@ extension String {
|
||||
"time": time
|
||||
]
|
||||
}
|
||||
|
||||
func parseUtcIsoDate() -> Date? {
|
||||
let formatter = DateFormatter()
|
||||
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss"
|
||||
formatter.locale = Locale(identifier: "en_US_POSIX")
|
||||
formatter.timeZone = TimeZone(secondsFromGMT: 0)
|
||||
return formatter.date(from: self)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user