JRavi2 / Chat-Analyzer

A python program to analyze your Social Chats
12 stars 8 forks source link

Date and time issue in whatsapp chat #13

Closed sasidampuri closed 2 years ago

sasidampuri commented 2 years ago

The reason for getting the error for different formats of whatsapp file is a single regex pattern trying to match all formats. So, for the date i maintained three patterns

  1. To get the date if it is in the format m/d/y(type1)
  2. To get the date if it is in the format d/m/y(type2
  3. To get the date if it is in the format y/m/d(type3)

And for the time i maintained two pattens

  1. 12-hour clock pattern
  2. 24-hour clock pattern
JRavi2 commented 2 years ago

@sasidampuri Thanks for the PR!

This implementation, although perfectly functional, is not quite clean and hard to modify in the future. Instead of having 3 different patterns for different types of dates, could you try incorporating all three date formats into one regex? I think that should be possible to implement. Lemme know if you need any help with that.

Also, the implementation for different formats time formats is being implemented in #11, so you don't need to worry about that.

Just a small suggestion, whenever you create a PR, you can add "Closes #10" (here "10" is the relevant Issue number) in the comment. This will link your PR to the appropriate issue and close that issue as soon as the PR is merged. Reference: https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue