fix a bug with date, duration

This commit is contained in:
jinhojang6 2020-03-13 01:30:49 +09:00
parent 542e0c3a2f
commit 9ffa46dfeb
No known key found for this signature in database
GPG Key ID: 0E7AA62CB0D9E6F3
4 changed files with 8 additions and 6 deletions

View File

@ -11,6 +11,7 @@ let parser = new Parser({
maxRedirects: 100,
customFields: {
feed: ['description', 'description'],
feed: ['pubDate', 'pubDate'],
}
});
@ -33,6 +34,7 @@ export const fetchPodcast = url => dispatch => {
const episodes = feed.items
const description = feed.description
const img = feed.image
const pubDate = feed.pubDate
if (website.substring(0,3) === 'www') {
website = 'https://' + website;
@ -47,7 +49,8 @@ export const fetchPodcast = url => dispatch => {
author,
website,
episodes,
description
description,
pubDate
}
})
}

View File

@ -38,8 +38,8 @@ class EpisodeList extends Component {
theme={theme}
title={e.title}
trackId={e.guid}
date={e.published}
duration={e.duration}
date={e.pubDate}
duration={e.itunes.duration}
audio={e.enclosure.url}
description={e.description}
setEpisode={this.setEpisode}

View File

@ -38,7 +38,7 @@ class EpisodeListElement extends Component {
const now = moment()
const releaseDate = moment(date)
return now.diff(releaseDate, 'days') > 14
return now.diff(releaseDate, 'days') > 5
? moment(date).format('LL')
: moment(date).fromNow()
}
@ -46,7 +46,7 @@ class EpisodeListElement extends Component {
render() {
const { date, title, theme, trackId, duration, nowPlayingId } = this.props
const isPlaying = trackId === nowPlayingId
const minutesLong = Math.round(
moment.duration(duration, 'seconds').asMinutes()
)

View File

@ -44,7 +44,6 @@ button {
}
.error {
z-index: 9999;
position: absolute;
top: 30%;
left: 50%;