From 34a681824294659da754040a049c13f77bdda62d Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 8 Oct 2022 17:36:13 -0700 Subject: [PATCH] EditDate: fix division by zero (#56) --- src/components/EditDate.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/EditDate.vue b/src/components/EditDate.vue index 01df406d..6772a547 100644 --- a/src/components/EditDate.vue +++ b/src/components/EditDate.vue @@ -300,7 +300,8 @@ export default class EditDate extends Mixins(GlobalMixin) { } const offset = date.getTime() - pDate.getTime(); - const pDateNew = new Date(dateNew.getTime() - offset * (diffNew / diff)); + const scale = diff > 0 ? (diffNew / diff) : 0; + const pDateNew = new Date(dateNew.getTime() - offset * scale); const res = await axios.patch(generateUrl(EDIT_API_URL, { id: p.fileid }), { date: this.getExifFormat(pDateNew), });