srawlins / timezone

Time zone database and time zone aware DateTime object for Dart.
BSD 2-Clause "Simplified" License
102 stars 54 forks source link

Daylight Savings & Abbreviations #58

Open jeffscaturro-aka opened 4 years ago

jeffscaturro-aka commented 4 years ago

"Issue" First off, let me prefix this by saying this is working correctly, just not as users may expect, and it would be cool to add a feature along the lines of the possible solution below.

Daylight savings happened and abbreviations are now being displayed as "PDT", "EDT", "MDT", etc. Where the "D" refers to "Daylight" rather than "Standard" in "PST", "EST", and "MST".

There can be cases where a consumer may want to display "EST" year-round, instead of "EDT" for half the year, just because their userbase may be unaware of what "EDT" means. We'd like to use "EDT" to expose users to this knowledge, but clients may not see it the same way.

Insight It looks like we have access to the "non-daylight-time zone" by looking at https://github.com/srawlins/timezone/blob/f2d4ebddaaa7a4633d178ac4bf32894619cbcf56/lib/src/location.dart#L168-L210

Since we can check if the time is daylight savings: https://github.com/srawlins/timezone/blob/f2d4ebddaaa7a4633d178ac4bf32894619cbcf56/lib/src/location.dart#L233-L234

We could potentially add something like ignoreDstAbbv to match the existing abbv: https://github.com/srawlins/timezone/blob/f2d4ebddaaa7a4633d178ac4bf32894619cbcf56/lib/src/location.dart#L236-L237

Is this something that you'd be open to adding, or accepting a PR for if done? We realize we may also be a minority in this situation and most people would be fine with having the "EST"/"EDT" difference.

srawlins commented 4 years ago

Hi @jeffscaturro-aka , I think this feature sounds reasonable. I'm honestly not familiar with the data format that the https://github.com/srawlins/timezone/blob/master/tool/get.dart script uses to write out the data files. So I'd be happy to accept a PR, but I don't think I could dedicate a lot of time to helping with it :/.

jeffscaturro-aka commented 4 years ago

@srawlins thanks for the quick reply! That's understandable, if we get around to placing a high priority on this we'll more than happily help out.

Feel free to keep the issue open for others to reference, or close it out as it was mostly a question of if this feature would fit in which could then be referenced in the commit(s).