Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Even numbers don't seem to be kosher, only strings work

Manav Rathi28cf7d76d552
diff --git a/web/apps/photos/src/components/FixCreationTime.tsx b/web/apps/photos/src/components/FixCreationTime.tsx
index a606facd94..62c31539a7 100644
--- a/web/apps/photos/src/components/FixCreationTime.tsx
+++ b/web/apps/photos/src/components/FixCreationTime.tsx
@@ -32,12 +32,12 @@ export type FixOption =
interface FormValues {
option: FixOption;
/**
- * Date.getTime()
+ * Date.toISOString()
*
* Formik doesn't have native support for JS dates, so we instead keep the
- * corresponding date's epoch milliseconds as the form state.
+ * corresponding date's ISO string representation as the form state.
*/
- customTime: number;
+ customTimeString: string;
}
interface FixCreationTimeProps {
@@ -69,7 +69,7 @@ const FixCreationTime: React.FC<FixCreationTimeProps> = (props) => {
const completedWithErrors = await updateCreationTimeWithExif(
props.attributes.files,
values.option,
- new Date(values.customTime),
+ new Date(values.customTimeString),
setProgressTracker,
);
setStep(completedWithErrors ? "completed-with-errors" : "completed");
@@ -138,7 +138,7 @@ const OptionsForm: React.FC<OptionsFormProps> = ({ step, onSubmit, hide }) => {
const { values, handleChange, handleSubmit } = useFormik({
initialValues: {
option: "date-time-original",
- customTime: Date.now(),
+ customTimeString: new Date().toISOString(),
},
validateOnBlur: false,
onSubmit,
@@ -179,7 +179,9 @@ const OptionsForm: React.FC<OptionsFormProps> = ({ step, onSubmit, hide }) => {
{values.option === "custom-time" && (
<EnteDateTimePicker
onSubmit={(d: Date) =>
- handleChange("customTime")(d.getTime())
+ handleChange("customTimeString")(
+ d.toISOString(),
+ )
}
/>
)}