mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-17 00:28:05 +00:00
fix: correct invalid BCP 47 language tag in Jellyseerr components
Fix RangeError caused by invalid locale tags (e.g., zh-CN-US) in multiple Jellyseerr components. The locale variable already contains a complete BCP 47 language tag (e.g., zh-CN), so concatenating it with region (e.g., US) creates an invalid tag. Changes: - DetailFacts.tsx: Fix 5 occurrences in date and currency formatting - JellyseerrSeasons.tsx: Fix 1 occurrence in upcoming air date - person/[personId].tsx: Fix 1 occurrence in birthday formatting Total: 3 files, 7 fixes Closes #1130 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -88,14 +88,11 @@ export default function page() {
|
||||
<Text className='opacity-50'>
|
||||
{t("jellyseerr.born")}{" "}
|
||||
{data?.details?.birthday &&
|
||||
new Date(data.details.birthday).toLocaleDateString(
|
||||
`${locale}-${region}`,
|
||||
{
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
},
|
||||
)}{" "}
|
||||
new Date(data.details.birthday).toLocaleDateString(locale, {
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
})}{" "}
|
||||
| {data?.details?.placeOfBirth}
|
||||
</Text>
|
||||
</>
|
||||
|
||||
@@ -81,10 +81,7 @@ const DetailFacts: React.FC<
|
||||
const firstAirDate = useMemo(() => {
|
||||
const firstAirDate = (details as TvDetails)?.firstAirDate;
|
||||
if (firstAirDate) {
|
||||
return new Date(firstAirDate).toLocaleDateString(
|
||||
`${locale}-${region}`,
|
||||
dateOpts,
|
||||
);
|
||||
return new Date(firstAirDate).toLocaleDateString(locale, dateOpts);
|
||||
}
|
||||
}, [details]);
|
||||
|
||||
@@ -92,28 +89,25 @@ const DetailFacts: React.FC<
|
||||
const firstAirDate = (details as TvDetails)?.firstAirDate;
|
||||
const nextAirDate = (details as TvDetails)?.nextEpisodeToAir?.airDate;
|
||||
if (nextAirDate && firstAirDate !== nextAirDate) {
|
||||
return new Date(nextAirDate).toLocaleDateString(
|
||||
`${locale}-${region}`,
|
||||
dateOpts,
|
||||
);
|
||||
return new Date(nextAirDate).toLocaleDateString(locale, dateOpts);
|
||||
}
|
||||
}, [details]);
|
||||
|
||||
const revenue = useMemo(
|
||||
() =>
|
||||
(details as MovieDetails)?.revenue?.toLocaleString?.(
|
||||
`${locale}-${region}`,
|
||||
{ style: "currency", currency: "USD" },
|
||||
),
|
||||
(details as MovieDetails)?.revenue?.toLocaleString?.(locale, {
|
||||
style: "currency",
|
||||
currency: "USD",
|
||||
}),
|
||||
[details],
|
||||
);
|
||||
|
||||
const budget = useMemo(
|
||||
() =>
|
||||
(details as MovieDetails)?.budget?.toLocaleString?.(
|
||||
`${locale}-${region}`,
|
||||
{ style: "currency", currency: "USD" },
|
||||
),
|
||||
(details as MovieDetails)?.budget?.toLocaleString?.(locale, {
|
||||
style: "currency",
|
||||
currency: "USD",
|
||||
}),
|
||||
[details],
|
||||
);
|
||||
|
||||
@@ -171,7 +165,7 @@ const DetailFacts: React.FC<
|
||||
)}
|
||||
<Text>
|
||||
{new Date(r.release_date).toLocaleDateString(
|
||||
`${locale}-${region}`,
|
||||
locale,
|
||||
dateOpts,
|
||||
)}
|
||||
</Text>
|
||||
|
||||
@@ -69,7 +69,7 @@ const RenderItem = ({ item }: any) => {
|
||||
if (airDate) {
|
||||
const airDateObj = new Date(airDate);
|
||||
if (new Date() < airDateObj) {
|
||||
return airDateObj.toLocaleDateString(`${locale}-${region}`, dateOpts);
|
||||
return airDateObj.toLocaleDateString(locale, dateOpts);
|
||||
}
|
||||
}
|
||||
}, [item, locale, region]);
|
||||
|
||||
Reference in New Issue
Block a user