Skip to content
This repository

dc:date parsing? #65

Closed
wants to merge 3 commits into from

2 participants

Ryan Curtis Dan MacTough
Ryan Curtis

Not sure if you're going to be interested in this, but I found that dc:date wasnt getting parsed correctly for this feed: http://www.tabletitans.com/feed, and this patch fixes that. I wrote the oneliner in coffeescript, which is why its rather ugly.

date = utils.get(el) ? new Date(el[0]?['#']) ? new Date(el['#']) ? null

but it should be backwards compatible.

Dan MacTough
Owner

Thanks for the PR.

The existing date parsing is fine (pretty much). The actual problem is that that feed repeats the dc:date element for each item. That is completely illogical (although the Dublin Core spec fails to say whether you may or may not do that).

In any event, I'm going to close this issue/PR and open a new one to solve the problem more generally (handle unexpected arrays).

Dan MacTough danmactough closed this May 16, 2013
Dan MacTough danmactough reopened this June 03, 2013
Dan MacTough danmactough closed this in 06fe385 June 03, 2013
Dan MacTough
Owner

@rbrcurtis FYI -- You were right. There was a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
1  .gitignore
... ...
@@ -0,0 +1 @@
  1
+node_modules
3  main.js
@@ -731,7 +731,8 @@ FeedParser.prototype.handleItem = function handleItem (node, type, options){
731 731
       case('modified'):
732 732
       case('updated'):
733 733
       case('dc:date'):
734  
-        var date = utils.get(el) ? new Date(el['#']) : null;
  734
+        var date, _ref, _ref2, _ref3, _ref4;
  735
+        date = (_ref = (_ref2 = (_ref3 = utils.get(el)) != null ? _ref3 : new Date((_ref4 = el[0]) != null ? _ref4['#'] : void 0)) != null ? _ref2 : new Date(el['#'])) != null ? _ref : null;
735 736
         if (!date) break;
736 737
         if (item.pubdate === null || name == 'pubdate' || name == 'published' || name == 'issued')
737 738
           item.pubdate = item.pubDate = date;
2  package.json
@@ -2,7 +2,7 @@
2 2
   "name": "feedparser",
3 3
   "author": "Dan MacTough <danmactough@gmail.com>",
4 4
   "description": "Robust RSS Atom and RDF feed parsing using sax js",
5  
-  "version": "0.15.3",
  5
+  "version": "0.15.4",
6 6
   "keywords": [
7 7
     "rss",
8 8
     "feed",
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.