Skip to content

Commit

Permalink
fix: normalizing dates - part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterds committed Jul 5, 2023
1 parent ae831f7 commit ff72145
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/store/utils/normalizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,23 @@ export const Normalizer = {
},

movie: (item: any) => {
if (!item.release_date) {
return null;
}

return {
...Normalizer.mediaAsset({ ...item, media_type: 'movie' }),
release_date: new Date(item.release_date),
release_date: new Date(`${item.release_date} 00:00:00`),
} as Movie;
},

show: (item: any) => {
if (!item.first_air_date) {
return null;
}

return {
...Normalizer.mediaAsset({ ...item, media_type: 'show' }),
first_air_date: new Date(item.first_air_date),
first_air_date: new Date(`${item.first_air_date} 00:00:00`),
} as Show;
},

video: (item: any) => {
return {
...item,
published_at: new Date(item.published_at),
published_at: new Date(`${item.published_at} 00:00:00`),
} as Video;
},
};

0 comments on commit ff72145

Please sign in to comment.