From 38b84bb8051db2f03b152d66c34a1cb4c8944a12 Mon Sep 17 00:00:00 2001
From: Sebastian <sebasjm@gmail.com>
Date: Fri, 12 Nov 2021 13:12:27 -0300
Subject: fix #7059

---
 packages/anastasis-webui/src/components/fields/DateInput.tsx | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 'packages/anastasis-webui/src/components/fields/DateInput.tsx')

diff --git a/packages/anastasis-webui/src/components/fields/DateInput.tsx b/packages/anastasis-webui/src/components/fields/DateInput.tsx
index 0b6a7e316..18ef89908 100644
--- a/packages/anastasis-webui/src/components/fields/DateInput.tsx
+++ b/packages/anastasis-webui/src/components/fields/DateInput.tsx
@@ -1,4 +1,4 @@
-import { format, isAfter, parse, sub, subYears } from "date-fns";
+import { format, subYears } from "date-fns";
 import { h, VNode } from "preact";
 import { useLayoutEffect, useRef, useState } from "preact/hooks";
 import { DatePicker } from "../picker/DatePicker";
@@ -9,6 +9,7 @@ export interface DateInputProps {
   tooltip?: string;
   error?: string;
   years?: Array<number>;
+  onConfirm?: () => void;
   bind: [string, (x: string) => void];
 }
 
@@ -44,7 +45,12 @@ export function DateInput(props: DateInputProps): VNode {
               type="text"
               class={showError ? "input is-danger" : "input"}
               value={value}
-              onInput={(e) => {
+              onKeyPress={(e) => {
+                if (e.key === 'Enter' && props.onConfirm) {
+                  props.onConfirm()
+                }
+              }}
+                  onInput={(e) => {
                 const text = e.currentTarget.value;
                 setDirty(true);
                 props.bind[1](text);
-- 
cgit v1.2.3

