Download NetflixClone/src/utils/time.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 594 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/utils/time.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/utils/time.js
-
curl -L -o time.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/NetflixClone/src/utils/time.js
594 Bytes
| import React from 'react' | |
| const convertTimeToHourMinuteFormat = timeInHours => { | |
| var hours = Math.trunc(timeInHours / 60); | |
| var minutes = timeInHours % 60; | |
| return `${hours}h ${minutes}m` | |
| } | |
| export const getSeasonsOrMovieLength = (seasons, runtime) => { | |
| let timeSpan | |
| if (runtime) { | |
| timeSpan = <span>{convertTimeToHourMinuteFormat(runtime)}</span> | |
| } else if (seasons) { | |
| timeSpan = ( | |
| <span> | |
| {seasons.length > 1 ? `${seasons.length} Seasons` : `${seasons.length} Season`} | |
| </span> | |
| ) | |
| } | |
| return timeSpan | |
| } |