Hi, I figured out how to change the date format from dd MMM yyyy to yyyy-mm-dd!
I did it by making some changes to the movies.js script.
At the end of the file I added following function:
function convertDateFormat(dateStr) {
// Split the input date string by spaces
let parts = dateStr.split(" ");
// Extract day, abbreviated month, and year
let day = parts[0];
let month = parts[1];
let year = parts[2];
// Map month abbreviations to their corresponding numerical values
const monthMap = {
Jan: "01",
Feb: "02",
Mar: "03",
Apr: "04",
May: "05",
Jun: "06",
Jul: "07",
Aug: "08",
Sep: "09",
Oct: "10",
Nov: "11",
Dec: "12"
};
// Convert the abbreviated month to its numerical value
let monthNum = monthMap[month];
// Format the date as YYYY-MM-DD
let formattedDate = `${year}-${monthNum}-${day}`;
return formattedDate;
}
In the start function I modified this code block (lines 51-59) from:
QuickAdd.variables = {
...selectedShow,
actorLinks: linkifyList(selectedShow.Actors.split(",")),
genreLinks: linkifyList(selectedShow.Genre.split(",")),
directorLink: linkifyList(selectedShow.Director.split(",")),
fileName: replaceIllegalFileNameCharactersInString(selectedShow.Title),
typeLink: `[[${selectedShow.Type === "movie" ? "Movies" : "Series"}]]`,
languageLower: selectedShow.Language.toLowerCase(),
}
To:
QuickAdd.variables = {
...selectedShow,
actorLinks: linkifyList(selectedShow.Actors.split(",")),
genreLinks: linkifyList(selectedShow.Genre.split(",")),
directorLink: linkifyList(selectedShow.Director.split(",")),
fileName: replaceIllegalFileNameCharactersInString(selectedShow.Title),
releaseDate: convertDateFormat(selectedShow.Released),
typeLink: `[[${selectedShow.Type === "movie" ? "Movies" : "Series"}]]`,
languageLower: selectedShow.Language.toLowerCase(),
Note the added “releaseDate” variable
In your template, use {{VALUE:releaseDate}} instead of {{VALUE:Released}}
Change that property type to date and it should work!
I don’t use Dataview (yet) so please let me know if it works for you.l