naoty / Timepiece

Intuitive date handling in Swift
MIT License
2.63k stars 147 forks source link

How to modify the time zone #80

Closed shiqianren closed 7 years ago

shiqianren commented 7 years ago

How to modify the time zone,Get today's time is wrong( NSDate.today())

naoty commented 7 years ago

There is not such a feature. If the return value of Date.today() have wrong time zone, you should use a calendar different from Calendar.current instead of this library, because Timepiece uses Calendar.current.

shiqianren commented 7 years ago

sorry i can't understand ( use a calendar different from Calendar.current instead of this library) ? ? ?

naoty commented 7 years ago

If you use a calendar different from Calendar.current such as Calendar(identifier: .chinese) or Calendar(identifier: .buddhist), the return value of Date.today() may be wrong, because Timepiece always uses Calendar.current to calculate dates. See here.

So, if you want to modify time zone, you should use another library.

naoty commented 7 years ago

@shiqianren I will close this issue. But, if your question is not solved yet, I will reopen this.