Created
February 5, 2016 06:40
-
-
Save wookay/db4b5ebb154a39df8c88 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
class TestDates: WTestCase { | |
func test_dates() { | |
Assert.equal("ko", NSLocale.currentLocale().languageCode) | |
let d = NSDate(year: 2016, month: 2, day: 5, hour: 13, min: 2, sec: 3) | |
Assert.equal("", d.string(.NoStyle)) | |
Assert.equal("2016. 2. 5. 오후 1:02", d.string(.ShortStyle)) | |
Assert.equal("2016. 2. 5. 오후 1:02:03", d.string(.MediumStyle)) | |
Assert.equal("2016년 2월 5일 오후 1시 2분 3초 GMT+9", d.string(.LongStyle)) | |
Assert.equal("2016년 2월 5일 금요일 오후 1시 2분 3초 대한민국 표준시", d.string(.FullStyle)) | |
Assert.equal("2016. 2. 5.", d.string(date: .ShortStyle)) | |
Assert.equal("2016. 2. 5.", d.string(date: .MediumStyle)) | |
Assert.equal("2016년 2월 5일", d.string(date: .LongStyle)) | |
Assert.equal("2016년 2월 5일 금요일", d.string(date: .FullStyle)) | |
Assert.equal("오후 1:02", d.string(time: .ShortStyle)) | |
Assert.equal("오후 1:02:03", d.string(time: .MediumStyle)) | |
Assert.equal("오후 1시 2분 3초 GMT+9", d.string(time: .LongStyle)) | |
Assert.equal("오후 1시 2분 3초 대한민국 표준시", d.string(time: .FullStyle)) | |
Assert.equal("2016-02-05 13:02:03", d.string(.yyyyMMdd_HHmmss)) | |
Assert.equal("2016-02-05 13:02:03.000", d.string(.yyyyMMdd_HHmmssSSS)) | |
let n = NSDate() | |
let time = n.hour_min_sec_nano | |
let nano = roundString(Double(time.nano)/1000000, n: 3) | |
Assert.equal(nano, n.string(.SSS)) | |
} | |
} |
Author
wookay
commented
Feb 5, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment