-
Notifications
You must be signed in to change notification settings - Fork 73
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
ValueError: day is out of range for month #57
Comments
Wonder if its a leap year issue with a birthdate on 29 Feb. What language is your Facebook in? |
English |
Hi, thank you for the script! I had the same error and it seems it has to do with the leap year, the script ran fine when I changed all parts with datetime.now() in cur_date and start_date to datetime(2020, 1, 1, 9, 40, 6, 659499). |
Hmm so from the looks of it there is a friend with a birthday on Wouldn't have been fixed in: 7da11cf |
I have a similar behavior.
|
Can confirm I had this error with a friend whose birthday is on 29 Feb. |
when i delete my friend who has birthday on feb 29. this would be a workaround? Haha yes deleted the friend and than it worked fine :) |
So I just looked into this. The issue isn't the fact that there's a person with a leap year in the data, but rather that when there does exist a person with a leap year, the scraper scrapes the dates out of order towards the end of February. The person with the leap year birthday is inserted into the birthdays list in between all the 4/28 birthdays. Confirmed this by first trying a birthdays list with no leap year birthdays, and trying a list without any 4/28 birthdays but with a leap year birthday. Seems like a pretty easy fix since it doesn't really involve dates, just how the birthdays are being inserted into the birthdays list. A hotfix could be as simple as a sort in the populate_birthdays_calendar function. Also this could really benefit from an optional caching function. It was painful seeing all the work go away when I hit the error right during export. Would love to help. Just lmk. |
Hi, I got this as well today. The console (only) its showing the following at the tail:- [2020-05-09 13:02:42,399] fb2cal INFO (main) A total of 99 birthdays were found. [2020-05-09 13:02:42,399] fb2cal INFO (main) Creating birthday ICS file... Traceback (most recent call last): File "src/fb2cal.py", line 815, in main() File "src/fb2cal.py", line 127, in main c = populate_birthdays_calendar(birthdays) File "src/fb2cal.py", line 800, in populate_birthdays_calendar e.begin = f'{year}-{month}-{day} 00:00:00' File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/ics/event.py", line 155, in begin value = get_arrow(value) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/ics/utils.py", line 196, in get_arrow return arrow.get(value) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/api.py", line 21, in get return _factory.get(*args, **kwargs) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/factory.py", line 207, in get dt = parser.DateTimeParser(locale).parse_iso(arg) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/parser.py", line 131, in parse_iso return self._parse_multiformat(string, formats) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/parser.py", line 312, in _parse_multiformat _datetime = self.parse(string, fmt) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/parser.py", line 205, in parse return self._build_datetime(parts) File "/Users/davidwishart/.pyenv/versions/3.7.7/lib/python3.7/site-packages/arrow/parser.py", line 301, in _build_datetime tzinfo=parts.get("tzinfo"), ValueError: day is out of range for month Interestingly (or not) the debug level logging to logs\fb2cal.log has the last line of [2020-05-09 13:02:42,399] fb2cal INFO (main) Creating birthday ICS file... It looks like this has already been identified as a bug so I was wondering what if anything I could do so someone could look at resolving? |
I forked your repo @mobeigi and did a pretty ugly/unoptimized fix and also added an caching function for faster testing of bugs closer towards the end (just saving the birthday list to a pickle file) on the forked repo so you can decide if you want to implement the quick-fix. Thank you for this repo. It's really helped. |
Fixed in #64 . Thanks! |
Another good way is to write a python script in Django which runs automatically to delete invalid date entries. For example
In
This command |
I get the following output on Python 3.7.1
The text was updated successfully, but these errors were encountered: