#1 : 21/10-22 15:57 Daniel Gruner
Posts: 5
|
Hi, I hope the following helps. :)
The script takes the "CreateDate" from exif, looks up a give time offset and normalize it to UTC+0. I recognized that .mov from a Google Photos export was UTC+0 and .heic was UTC+2. This offset made my renaming obsolete. Thats why I developed this script to normalize the dates. var fileName = item.name; var createDate = item.exifToolValue("CreateDate"); var offsetTime = item.exifToolValue("OffsetTime"); // var fileName = "IMG_0362.HEIC"; // var createDate = "2022:05:20 17:39:09"; // var offsetTime = "+02:00" // ISO date: 2009-06-30T18:30:00+02:00 if(!createDate){ return fileName } var createDateDate = createDate.split(' ')[0].replace(/:/gm, '-'); var createDateTime = createDate.split(' ')[1]; if(!offsetTime){ offsetTime = "+00:00" } // returns 2022-05-22T17:39:09+02:00 var myNewDateString = createDateDate + "T" + createDateTime + offsetTime; // returns 2022-05-22T15:39:09.000Z (normalized to UTC+0) var myNormalizedDate = new Date(myNewDateString).toISOString(); // returns 2022-05-22T15:39:09 var finalDateString = myNormalizedDate.split('.')[0].replace(/:/gm, '-') return finalDateString + ".0Z_" + fileName |