sisyphsu / dateparser

dateparser is a smart and high-performance date parser library, it supports hundreds of different formats, nearly all format that we may used. And this is also a showcase for "retree" algorithm.
MIT License
96 stars 24 forks source link

Add new method parseDate2(..) with fixed behaviour for Dst offset #16

Closed andriy-samson closed 3 years ago

andriy-samson commented 3 years ago

To revial the problem of Daylight Saving Time(DST), you can uncomment the test case: DateParserTest.test_showsDstProblem() Also, I think that the problem is visible only when it runs on machine with time zone where DST is active during the test. For example on machine with regional settings of time zone where the it has DST activated (summer period)

To avoid backward compatibility problem I didn't change the internal implementation of DateBuilder.toDate() method wher the original time zone offset computation is done. Instead I try to add a new method with expected (fixed) fixed behaviour.

Let me know if you need more information, Regards, Andriy

sisyphsu commented 3 years ago

You modified too many codes, I cannot accept it, sry.

And I think there should have a better way to support DST offset, pls give me some time.

andriy-samson commented 3 years ago

Thanks for your feedback. I didn't expect this pull request to be accepted it as it is. In this pull request I would like just to show the problem (in test cases) and possible solution just using external API. For sure there is a better fix. The real fix has to be done in DateBuilder.toDate() or deeper.

The idea is simple:

I will try to revert all and find a better solution for this problem.

Regards, Andriy.