jsumners / jsumners/feedparser

Datetime with swapped year/timezone parsed incorrectly

Open
#404 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-migrated
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

While moving from Feedparser 5.1 to 5.1.3 the time detection changed in some 
ways.

With Feedparser 5.1 a string ``'Sun Jul 15 00:15:00 +0000 2012'`` was correctly 
recognized as

time.struct_time(tm_year=2012, tm_mon=7, tm_mday=15, tm_hour=0, tm_min=15, 
tm_sec=0, tm_wday=6, tm_yday=197, tm_isdst=0)

. After the updated it is recognized as

time.struct_time(tm_year=2000, tm_mon=7, tm_mday=15, tm_hour=0, tm_min=0, 
tm_sec=0, tm_wday=5, tm_yday=197, tm_isdst=0)

which is, obviously, not what we want.

To make this actually work with 5.1.3 I created my on parser using the dateutil 
library:

import dateutil
def dateutilDateHandler(aDateString):
    return dateutil.parser.parse(aDateString).utctimetuple()
feedparser.registerDateHandler(dateutilDateHandler)

Original issue reported on code.google.com by jammamar...@gmail.com on 29 May 2013 at 3:53

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported date string through feedparser's date detection and compare its result with the expected time.struct_time from Feedparser 5.1. Review the registerDateHandler entry point and the dateutil.parser.parse workaround described in the issue. Done means the string yields year 2012, minute 15, and the expected weekday and day-of-year values.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.