From fd6de8e621cc9a4e388ebe4de27ecc6462eb5b27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Thu, 2 Oct 2025 16:00:15 +0200 Subject: [PATCH] Form tests --- packages/example/src/routes/form.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/example/src/routes/form.tsx b/packages/example/src/routes/form.tsx index cef0a5a..803c7ec 100644 --- a/packages/example/src/routes/form.tsx +++ b/packages/example/src/routes/form.tsx @@ -4,6 +4,7 @@ import { Console, Effect, Option, ParseResult, Schema } from "effect" import { Component, Form, Hooks } from "effect-fc" import { TextFieldFormInput } from "@/lib/form/TextFieldFormInput" import { TextFieldFormOptionalInput } from "@/lib/form/TextFieldFormOptionalInput" +import { DateTimeUtcFromZonedInput } from "@/lib/schema" import { runtime } from "@/runtime" @@ -20,7 +21,7 @@ const email = Schema.pattern( const RegisterFormSchema = Schema.Struct({ email: Schema.String.pipe(email), password: Schema.String.pipe(Schema.minLength(3)), - iq: Schema.OptionFromSelf(Schema.NumberFromString), + birth: Schema.OptionFromSelf(DateTimeUtcFromZonedInput), }) class RegisterForm extends Effect.Service()("RegisterForm", { @@ -38,7 +39,7 @@ class RegisterForm extends Effect.Service()("RegisterForm", { ), ), - initialEncodedValue: { email: "", password: "", iq: Option.none() }, + initialEncodedValue: { email: "", password: "", birth: Option.none() }, submit: v => Effect.sleep("500 millis").pipe( Effect.andThen(Console.log(v)), Effect.andThen(Effect.sync(() => alert("Done!"))), @@ -72,8 +73,9 @@ class RegisterPage extends Component.makeUntraced("RegisterPage")(function*() { />