Skip to content
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

TypeError: Object July 21, 1983 01:15:00 has no method 'toUTCString' #11

Closed
stevenshu512 opened this issue Sep 27, 2013 · 4 comments
Closed

Comments

@stevenshu512
Copy link

hi, the feed module is awesome. But when I was using this module by typing:

app.get('/rss', function (req, res) {
  var feed = new Feed({
   title:          'My Feed Title',
   description:    'This is my personnal feed!',
   link:           'http://example.com/',
   image:          'http://example.com/logo.png',
   copyright:      'Copyright © 2013 John Doe. All rights reserved',

   author: {
             name:       '',
             email:      '',
             link:       ''
           }
  });

  feed.item({
    id : 'kpi',
    title : 'kpi',
    link : 'http://10.154.145.48:3456/packageApp/kpi',
    date:   'July 21, 1983 01:15:00'
  });

  feed.category('Technologie');

  res.set('Content-Type', 'text/xml');
  res.send(feed.render('rss-2.0'));

});

and the result of running is:

TypeError: Object July 21, 1983 01:15:00 has no method 'toUTCString'
    at rss_2_0 (/Users/shao19/Code/my Coding/node/rss/node_modules/feed/lib/feed.js:242:43)
    at Feed.render (/Users/shao19/Code/my Coding/node/rss/node_modules/feed/lib/feed.js:42:24)
    at /Users/shao19/Code/my Coding/node/rss/app.js:60:17
    at callbacks (/Users/shao19/Code/my Coding/node/rss/node_modules/express/lib/router/index.js:161:37)
    at param (/Users/shao19/Code/my Coding/node/rss/node_modules/express/lib/router/index.js:135:11)

I was no idea why it could happy. Bacause when I typing :

@stevenshu512
Copy link
Author

app.get('/ts', function (req, res) {
  var born = new Date("July 21, 1983 01:15:00")
  console.log(born.toUTCString());
  res.send(200);
});

can successfully show the console.log!
so, what's the problem of "has no method 'toUTCString'".

wish you reply,thanks

@sigurdga
Copy link

sigurdga commented Oct 2, 2013

@stevenshu512 In your feed.item() you write date as a string. Try giving it a Date() object instead.

@stevenshu512
Copy link
Author

thanks sigurdga!

@jpmonette
Copy link
Owner

Thanks @sigurdga.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants