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
Daylight savings? #160
Comments
Thanks for opening this ticket! No, daylight saving time is completely ignored as metadata. feedparser's date parsers normalize everything to UTC so that there is no DST consideration.
If the date/time was represented in local time then "is_dst" would need to be set correctly. At this time, however, feedparser normalizes everything to UTC.
…On March 5, 2019 4:18:36 PM UTC, Julien Lhermitte ***@***.***> wrote:
It seems feedparser might be interpreting daylight savings
incorrectly:>
>
```>
data = """<?xml version="1.0" encoding="UTF-8"?>>
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"
xmlns:dc="http://purl.org/dc/elements/1.1/">>
<channel>>
<title>ARTS &amp; CULTURE - Los Angeles Times</title>>
<link>http://www.latimes.com/entertainment/arts/rss2.0.xml</link>>
<description>The best of arts and culture news from L.A. Times
columnists and critics. Read reviews and find event information for Los
Angeles.</description>>
<language>en-US</language>>
<copyright>©2019 Los Angeles Times</copyright>>
<lastBuildDate>Mon, 4 Mar 2019 11:19:15 -0800</lastBuildDate>>
<item>>
<title>(With pub date during DST) For the cult of Sondheim,
'Merrily We Roll Along,' and on, and on, and ...</title>>
<dc:creator>Stuart Emmrich</dc:creator>>
<link>http://www.latimes.com/entertainment/arts/la-et-cm-merrily-we-roll-along-20190304-story.html</link>>
<description><![CDATA[>
<p>In fall 1981, the most anticipated new musical of the Broadway
season was an adaptation of the 1934 Kaufman and Hart play “Merrily We
Roll Along,” with lyrics and music by Stephen Sondheim, a book by a
George Furth and direction by Hal Prince.</p> <p>The musical tells the
story of three young characters...</p>>
]]></description>>
<pubDate>Mon, 4 Jul 2019 04:00:00 PST</pubDate>>
<media:content
url="http://www.trbimg.com/img-5c7c2121/turbine/la-1551638807-umw4chssva-snap-image"
type="image/jpeg">>
<media:description type="plain"><![CDATA["Merrily We Roll
Along" director Noah Brody, far left, with cast members,
foreground from left, Jessie Austrian, Ben Steinfeld, Paul Coffey and
Brittany Bradford; in the back, Manu Narayan and Emily
Young.]]></media:description><media:credit role="author"
scheme="urn:ebu"><![CDATA[Jennifer S. Altman / For The
Times]]></media:credit></media:content>>
</item>>
</channel> >
</rss>>
""">
import feedparser>
feed_data = feedparser.parse(data)>
feed_entry = feed_data['entries'][0]>
```>
>
For this data, I get:>
```>
feed_entry['published'] :Mon, 4 Jul 2019 04:00:00 PST>
>
feed_entry['published_parsed']: time.struct_time(tm_year=2019,
tm_mon=7, tm_mday=4, tm_hour=12, tm_min=0, tm_sec=0, tm_wday=3,
tm_yday=185, tm_isdst=0)>
```>
This should be `tm_isdst=1` not `tm_isdst=0`.>
>
<img width="1021" alt="screen shot 2019-03-05 at 11 16 09 am"
src="https://user-images.githubusercontent.com/705366/53819535-1b490700-3f38-11e9-9dde-b09da98e08a2.png">>
>
>
Am I seeing things correctly? Is Daylight savings properly treated here
or has it not been considered yet? I may be able to help contribute.
thanks!>
>
-- >
You are receiving this because you are subscribed to this thread.>
Reply to this email directly or view it on GitHub:>
#160
|
Thanks for the quick response!
So then should the example above should have normalized to |
I don't think so. "PST" is equivalent to UTC-0800, so adding 8 hours to 4am give us noon as expected.
If the text had said "PDT" then the difference would be UTC-0700 and would have resulted in 11am.
…On March 5, 2019 4:36:05 PM UTC, Julien Lhermitte ***@***.***> wrote:
Thanks for the quick response!
> feedparser's date parsers normalize everything to UTC so that there
is no DST consideration.
So then should the example above should have normalized to `tm_hour=11`
not 12?
--
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#160 (comment)
|
Ah indeed. Thanks for the clarification. I assumed Thanks again for the quick response and very useful library. |
That's a good suggestion! Thanks! |
It seems feedparser might be interpreting daylight savings incorrectly:
For this data, I get:
This should be
tm_isdst=1
nottm_isdst=0
.Am I seeing things correctly? Is Daylight savings properly treated here or has it not been considered yet? I may be able to help contribute. thanks!
The text was updated successfully, but these errors were encountered: