Skip to content

Commit

Permalink
Fix release date handling on contribution streams
Browse files Browse the repository at this point in the history
  • Loading branch information
mhdzumair committed Feb 2, 2025
1 parent b9e2890 commit 9eafe63
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions resources/js/scraperControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -538,12 +538,17 @@ function showFileAnnotationModal(files) {
};

if (isSportsContent) {
const releaseDate = document.getElementById(`release-${index}`).value;
if (releaseDate) {
const dateParts = releaseDate.split('/');
const date = new Date(`${dateParts[1]}/${dateParts[0]}/${dateParts[2]}`);
baseData.release_date = date.toISOString().split('T')[0]
}
annotatedFiles.push({
...baseData,
title: document.getElementById(`title-${index}`).value || null,
overview: document.getElementById(`overview-${index}`).value || null,
thumbnail: document.getElementById(`thumbnail-${index}`).value || null,
release_date: document.getElementById(`release-${index}`).value || null,
});
} else {
annotatedFiles.push(baseData);
Expand Down Expand Up @@ -1397,9 +1402,19 @@ async function handleAddTorrent(submitBtn, loadingSpinner, forceImport = false,
// Add basic metadata to formData
formData.append('meta_type', metaType);
formData.append('torrent_type', torrentType);
formData.append('created_at', document.getElementById('createdAt').value);
formData.append('uploader', document.getElementById('uploaderName').value.trim() || 'Anonymous');

const createdAt = document.getElementById('createdAt').value;
if (createdAt) {
const dateParts = createdAt.split('/');
const date = new Date(`${dateParts[1]}/${dateParts[0]}/${dateParts[2]}`);
formData.append('created_at', date.toISOString().split('T')[0])
} else {
showNotification("Release Date is required.", 'error');
resetButton(submitBtn, loadingSpinner);
return;
}

// Add content metadata
if (!isSportsContent && document.getElementById('torrentImdbId')?.value) {
formData.append('meta_id', document.getElementById('torrentImdbId').value);
Expand Down

0 comments on commit 9eafe63

Please sign in to comment.