Handle invalid date in saveMany (#56)

pull/62/head
Varun Patil 2022-09-29 16:43:30 -07:00
parent 373d37ecf1
commit f108c31d67
3 changed files with 10 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -292,7 +292,13 @@ export default class EditDate extends Mixins(GlobalMixin) {
// Create PATCH requests
const calls = this.photos.map((p) => async () => {
try {
const pDate = new Date(p.datetaken);
let pDate = new Date(p.datetaken);
// Fallback to start date if invalid date
if (isNaN(pDate.getTime())) {
pDate = date;
}
const offset = date.getTime() - pDate.getTime();
const pDateNew = new Date(dateNew.getTime() - offset * (diffNew / diff));
const res = await axios.patch<any>(generateUrl(EDIT_API_URL, { id: p.fileid }), {