Closed satoshi-takano closed 6 years ago
Thank you for suggestion! 😄
I disagree with Date.defaultCalendar
. It is confusing because Date
object is a just value and independent of the calendar setting in iOS.
Instead, below method will fill your need.
Date().changed(on: .japanese)
Currently, changed()
calculates date components with Calendar.current
, and so on calendar: Calendar
argument will be useful for you.
Thank you for quick response! 😀 I think your idea is good way to change the calendar. I'll try it.
Sorry for less description. This method is not implemented yet. So, if you want it, please send a pull request!
Thank you for the description!
I decided to use Calendar
and DateComponent
directly to get year in Gregorian calendar. Because I noticed that Timepiece’s conveniences is based on Extension and I can’t add calendar as a stored property(also, I don’t want use Associated Object).
I want to change the default calendar. Because if someone uses Japanese calendar,
Date().year
returns the year in Japanese but I don't expect the behavior.I suggest the changes below.
What do you think? If you agree to my suggestion, I'll make a pull request.