Skip to content

Commit

Permalink
Update MovieDetail.jsx
Browse files Browse the repository at this point in the history
  • Loading branch information
rhose1234 authored Sep 18, 2023
1 parent fd45c83 commit a9bce07
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/MovieDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ export default function MovieDetail() {
const { id } = useParams();
const [movie, setMovie] = useState(null);

const formatDateToUTCString = (dateString) => {
const options = { year: 'numeric', month: 'long', day: 'numeric' };
return new Date(dateString).toLocaleDateString(undefined, options);
};


useEffect(() => {
const apiKey = import.meta.env.VITE_API_KEY;
const url = `https://api.themoviedb.org/3/movie/${id}`;
Expand Down Expand Up @@ -59,6 +65,8 @@ export default function MovieDetail() {
<span></span>
<div className="font-weight-bold" data-testid="movie-release-date">
{movie.release_date}
{formatDateToUTCString(movie.release_date)}

</div>
<span></span>
<div className="font-weight-bold mr-4">
Expand Down

0 comments on commit a9bce07

Please sign in to comment.