-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for time zones #1
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put each comment once, but the naming convention issue and the duplicate initialisers/functions is the same everywhere
Otherwise it looks like a useful feature! Thanks for contributing :)
self.init(base: base, timeZone: nil) | ||
} | ||
|
||
init(base: Date = Date(), timeZone: TimeZone?) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could just put a default argument value of nil for timeZone instead of creating another initialiser
} | ||
|
||
init(base: Date = Date(), timeZone: TimeZone?) { | ||
var GregorianCalendar: Calendar = Calendar.gregorian |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the Swift naming conventions: lowerCamelCase for variables
"Chamerops": "Chamaerops_humilis", | ||
"Épine vinette": "%C3%89pine-vinette", | ||
"Verge d'or": "Solidago" | ||
"Belle de nuit": "Mirabilis_jalapa", "Amaryllis": "Amaryllis_(plante)", "Erable sucré": "%C3%89rable_%C3%A0_sucre", "Perce Neige": "Perce-neige", "Laurier thym": "Viorne_tin", "Thimèle": "Daphn%C3%A9_garou", "Bâton d'or": "Girofl%C3%A9e_des_murailles", "Chamerops": "Chamaerops_humilis", "Épine vinette": "%C3%89pine-vinette", "Verge d'or": "Solidago" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avoid reformatting code, it's more readable line per line
…nCalendarCore when I created a pull request.
Requested changes have been made. Have run the unit tests just to make sure everything still works. |
self.init(romanYear: romanYear, variant: variant, treatSansculottidesAsAMonth: false) | ||
} | ||
|
||
public init(romanYear: Bool, variant: Variant, treatSansculottidesAsAMonth: Bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use a default value of false for treatSansculottidesAsAMonth instead of duplicating here too
It could also be useful to add unit tests for your additions; it's not necessary for treatSansculottidesAsAMonth, it's pretty straightforward, but the time zone support could be tested |
Thanks. I forgot about that one.
Aaron Adelman
… ב-4 באוג׳ 2022, בשעה 18:38, Emil Pedersen ***@***.***> כתב/ה:
@Snowy1803 commented on this pull request.
In Sources/FrenchRepublicanCalendarCore/FrenchRepublicanDateOptions.swift <#1 (comment)>:
> public init(romanYear: Bool, variant: Variant) {
+ self.init(romanYear: romanYear, variant: variant, treatSansculottidesAsAMonth: false)
+ }
+
+ public init(romanYear: Bool, variant: Variant, treatSansculottidesAsAMonth: Bool) {
Could use a default value of false for treatSansculottidesAsAMonth instead of duplicating here too
—
Reply to this email directly, view it on GitHub <#1 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHCTW3FPA6OJK5JIHBKFDXLVXPPXRANCNFSM55ORMWIQ>.
You are receiving this because you authored the thread.
|
Will see what I can do about that.
Aaron Adelman
… ב-4 באוג׳ 2022, בשעה 18:41, Emil Pedersen ***@***.***> כתב/ה:
It could also be useful to add unit tests for your additions; it's not necessary for treatSansculottidesAsAMonth, it's pretty straightforward, but the time zone support could be tested
—
Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHCTW3ENFREM3QGZV52LXI3VXPQCRANCNFSM55ORMWIQ>.
You are receiving this because you authored the thread.
|
Good call asking for time zone support unit tests. I’m getting some odd results for Anchorage and Honolulu. Looks like there’s some serious debugging to do to figure out what went wrong.
Aaron Adelman
… ב-4 באוג׳ 2022, בשעה 18:44, ד״ר אַהֲרֹן שְׁלֹמֹה אֵדֶלְמָן PhD ***@***.***> כתב/ה:
Will see what I can do about that.
Aaron Adelman
> ב-4 באוג׳ 2022, בשעה 18:41, Emil Pedersen ***@***.*** ***@***.***>> כתב/ה:
>
>
> It could also be useful to add unit tests for your additions; it's not necessary for treatSansculottidesAsAMonth, it's pretty straightforward, but the time zone support could be tested
>
> —
> Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHCTW3ENFREM3QGZV52LXI3VXPQCRANCNFSM55ORMWIQ>.
> You are receiving this because you authored the thread.
>
|
Sorry for this taking so long, but other things happening over here have made it not optimal for debugging. After a lot making it very explicit what is being tested, the tests finally all pass. This includes testing in the user’s time zone, 10 different time zones from across the planet, testing for 1970-01-01, and testing for 2022-08-08 (the date that particular subtest was written).
Enjoy.
Aaron Adelman
ד״ר אַהֲרֹן שְׁלֹמֹה אֵדֶלְמָן • Aaron Solomon Adelman, PhD
מתכנת • Programmer
***@***.***
http://www.linkedin.com/in/aaronsolomonadelman
… ב-4 באוג׳ 2022, בשעה 22:53, ד״ר אַהֲרֹן שְׁלֹמֹה אֵדֶלְמָן PhD ***@***.***> כתב/ה:
Good call asking for time zone support unit tests. I’m getting some odd results for Anchorage and Honolulu. Looks like there’s some serious debugging to do to figure out what went wrong.
Aaron Adelman
> ב-4 באוג׳ 2022, בשעה 18:44, ד״ר אַהֲרֹן שְׁלֹמֹה אֵדֶלְמָן PhD ***@***.*** ***@***.***>> כתב/ה:
>
> Will see what I can do about that.
>
> Aaron Adelman
>
>> ב-4 באוג׳ 2022, בשעה 18:41, Emil Pedersen ***@***.*** ***@***.***>> כתב/ה:
>>
>>
>> It could also be useful to add unit tests for your additions; it's not necessary for treatSansculottidesAsAMonth, it's pretty straightforward, but the time zone support could be tested
>>
>> —
>> Reply to this email directly, view it on GitHub <#1 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AHCTW3ENFREM3QGZV52LXI3VXPQCRANCNFSM55ORMWIQ>.
>> You are receiving this because you authored the thread.
>>
>
|
In incorporating FrenchRepublicanCalendarCore into one of my projects, I realized that it did not support time zones, so I fixed it. I also made it possible to treat Sansculottides as a 13th month in formatted dates, and I was very careful to make sure that the original API was still valid. Enjoy.