diff --git a/src/electron/frontend/core/components/pages/guided-mode/data/GuidedMetadata.js b/src/electron/frontend/core/components/pages/guided-mode/data/GuidedMetadata.js index f1deca9a4..a5db5846b 100644 --- a/src/electron/frontend/core/components/pages/guided-mode/data/GuidedMetadata.js +++ b/src/electron/frontend/core/components/pages/guided-mode/data/GuidedMetadata.js @@ -279,6 +279,8 @@ export class GuidedMetadataPage extends ManagedPage { delete results.__generated; // Ignore generated results. NOTE: See if this fails + const pageThis = this; + // Create the form const form = new JSONSchemaForm({ identifier: instanceId, @@ -333,7 +335,10 @@ export class GuidedMetadataPage extends ManagedPage { onUpdate: () => (this.unsavedUpdates = "conversions"), - validateOnChange: (...args) => validateOnChange.call(this, ...args), + validateOnChange: function (...args) { + this.timezone = pageThis.workflow?.timezone.value; // Set the timezone for the form + return validateOnChange.call(this, ...args); + }, onlyRequired: false, onStatusChange: (state) => this.manager.updateState(`sub-${subject}/ses-${session}`, state), diff --git a/src/electron/frontend/core/components/pages/guided-mode/setup/GuidedSubjects.js b/src/electron/frontend/core/components/pages/guided-mode/setup/GuidedSubjects.js index e385b843f..26c77c67e 100644 --- a/src/electron/frontend/core/components/pages/guided-mode/setup/GuidedSubjects.js +++ b/src/electron/frontend/core/components/pages/guided-mode/setup/GuidedSubjects.js @@ -102,6 +102,7 @@ export class GuidedSubjectsPage extends Page { connectedCallback() { super.connectedCallback(); + const pageThis = this; const schema = preprocessMetadataSchema(undefined, true).properties.Subject; const modal = (this.#globalModal = createGlobalFormModal.call(this, { @@ -110,7 +111,8 @@ export class GuidedSubjectsPage extends Page { validateEmptyValues: null, schema, formProps: { - validateOnChange: (localPath, parent, path) => { + validateOnChange: function (localPath, parent, path) { + this.timezone = pageThis.workflow?.timezone?.value; return validateOnChange.call(this, localPath, parent, ["Subject", ...path]); }, }, diff --git a/src/electron/frontend/core/validation/index.js b/src/electron/frontend/core/validation/index.js index f4fd1b4db..b7311e781 100644 --- a/src/electron/frontend/core/validation/index.js +++ b/src/electron/frontend/core/validation/index.js @@ -68,7 +68,7 @@ export async function validateOnChange(name, parent, path, value) { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ - timezone: this.workflow?.timezone?.value, + timezone: this.timezone, parent: copy, function_name: resolvedFunctionName, }),