var date = Date() ---> "Dec 8, 2017 at 6:35 PM"date.era ---> 1date.quarter ---> 0var date = Date() ---> date: "Dec 8, 2017 at 6:35 PM"
date.year = 2020 ---> date: "Jan 1, 2020 at 12:00 AM"
date.hour += 15 ---> date: "Jan 1, 2020 at 3:00 PM"
date.day += 20 ---> date: "Jan 21, 2020 at 12:00 AM"
maybe it is not expected, I just set the year a new value, but month, hour and others all changed, I think it's Apple's problems, but maybe we will never change a date like this way. So I suggest to change every date component computed property to be read-only.
@Asura19 Thank you for bringing this discussion
I'd be more than happy to answer your questions :)
_To confirm_:
Are you using the latest version v4.1 of SwifterSwift? since DateExtensions got a complete re-write in v4.1
@omaralbeik I'm terribly sorry, I got a v4.0.1 馃槄馃槄 馃槄馃槄 馃槄馃槄 馃槄馃槄, just a downloaded version in November, feeling embarrassed.................
@Asura19 No problems at all, please let me know if you have any other question :)
@omaralbeik what does "era" mean?
As Apple's documentation says :
The number of eras.
This value is interpreted in the context of the calendar with which it is used
Which is not clear for me 馃槄, I tried reading the following Wikipedia article as well, and here is what I found:
An era is a span of time defined for the purposes of chronology or historiography, as in the regnal eras in the history of a given monarchy, a calendar era used for a given calendar, or the geological eras defined for the history of Earth.
I've never used era before in any project, what we're doing in SwifterSwift is linking directly to Apple's era implementation.
You might want to ask the question in Apple's Support form to get a clear answer with an example :)
@omaralbeik Thank you very much!!!