From 1ca3dc5b9985e619a8f38a4c8314f8f0d7e54571 Mon Sep 17 00:00:00 2001 From: Maista <131594657+Maista6969@users.noreply.github.com> Date: Mon, 25 Sep 2023 05:05:24 +0200 Subject: [PATCH] Fix false positive mismatch in Movie Scrape dialog (#4144) * Fix false positive mismatch in Movie Scrape dialog Scraping a movie by URL would show a difference in duration because the persisted value of duration was converted to HH:MM:SS while the newly scraped value was displayed without formatting: this makes sense because the newly scraped value is just a string and so could be anything This adds a check to see if the string is a number and converts it to HH:MM:SS format if possible * Fallback to original value if not a number --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com> --- .../src/components/Movies/MovieDetails/MovieScrapeDialog.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx index f11edf6e8c3..2cba1e31533 100644 --- a/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx +++ b/ui/v2.5/src/components/Movies/MovieDetails/MovieScrapeDialog.tsx @@ -84,7 +84,10 @@ export const MovieScrapeDialog: React.FC = ( const [duration, setDuration] = useState>( new ScrapeResult( DurationUtils.secondsToString(props.movie.duration || 0), - props.scraped.duration + // convert seconds to string if it's a number + props.scraped.duration && !isNaN(+props.scraped.duration) + ? DurationUtils.secondsToString(parseInt(props.scraped.duration, 10)) + : props.scraped.duration ) ); const [date, setDate] = useState>(