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

Dateparser parsed the date incorrectly #3

Closed sivaramaaa closed 4 years ago

sivaramaaa commented 4 years ago

This is string : "Sat, 29 Feb 2020 01:21:19+5:30"

This is the output by dateparser : Sat, 29 Feb 2020 00:00:19 UTC

Expected output : Fri Feb 28 19:51:19 UTC 2020

The code is used :

                Date date = DateParserUtils.parseDate("Sat, 29 Feb 2020 01:21:19+5:30");
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z");
        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        System.out.println("Output: "+ dateFormat.format(date));
sisyphsu commented 4 years ago

This is because before 1.0.3 version, dateparser only support time-offset like +0530 +05:30 +05, it can't parse +5:30.

I have added the support for +5:30 in new version 1.0.4, you could try it out.

sivaramaaa commented 4 years ago

Hey thanks a lot for fixing it !

TBH your parser is working better than some nlp based parser , so 🤞 going to use this in my production server :)

sisyphsu commented 4 years ago

Thanks~