diff --git a/frontend/package.json b/frontend/package.json
index 17dd58803..96c2e99fc 100755
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -29,7 +29,7 @@
"@types/leaflet": "^1.9.12",
"@vee-validate/i18n": "^4.14.7",
"@vee-validate/rules": "^4.14.1",
- "@vee-validate/yup": "^4.14.1",
+ "@vee-validate/yup": "^4.15.0",
"@vitejs/plugin-vue": "5.1.4",
"@vue-leaflet/vue-leaflet": "^0.10.1",
"@vue/apollo-composable": "^4.0.2",
@@ -68,7 +68,7 @@
"vue-timer-hook": "^1.0.84",
"vuex": "^4.1.0",
"vuex-persistedstate": "^4.1.0",
- "yup": "^1.4.0"
+ "yup": "^1.6.1"
},
"devDependencies": {
"@apollo/client": "^3.10.8",
diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue
index 5612ae14b..3098a4dd1 100644
--- a/frontend/src/components/Contributions/ContributionForm.vue
+++ b/frontend/src/components/Contributions/ContributionForm.vue
@@ -5,26 +5,18 @@
class="form-style p-3 bg-white app-box-shadow gradido-border-radius"
@submit.prevent="submit"
>
-
-
-
-
-
-
+ :schema-description="schemaDescription.fields.date"
+ @update:model-value="updateField"
+ />
{{ noOpenCreation }}
@@ -39,12 +31,12 @@
@@ -88,12 +80,14 @@
\ No newline at end of file
diff --git a/frontend/src/pages/Community.vue b/frontend/src/pages/Community.vue
index 6ab7d9875..e728ae6ab 100644
--- a/frontend/src/pages/Community.vue
+++ b/frontend/src/pages/Community.vue
@@ -94,7 +94,7 @@ const form = ref({
id: null,
date: '',
memo: '',
- hours: 0,
+ hours: 0.0,
amount: '',
})
const originalContributionDate = ref('')
diff --git a/frontend/src/validationSchemas.js b/frontend/src/validationSchemas.js
new file mode 100644
index 000000000..6aa614f67
--- /dev/null
+++ b/frontend/src/validationSchemas.js
@@ -0,0 +1,15 @@
+import {object, string, date } from 'yup'
+
+export const createContributionFormValidation = (t) => {
+ return object({
+ // The date field is required and needs to be a valid date
+ // contribution date
+ date:
+ date()
+ .required(t('contribution.noDateSelected'))
+ .min((new Date(new Date().setMonth(new Date().getMonth() - 1, 1))).toISOString().slice(0,10)) // min date is first day of last month
+ .max(new Date().toISOString().slice(0,10))
+ .default(''), // date cannot be in the future
+ memo: string().required(t('')).min(5).max(255)
+ })
+}
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 7eb244d40..4ebc33d80 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -1657,14 +1657,13 @@
dependencies:
vee-validate "4.14.7"
-"@vee-validate/yup@^4.14.1":
- version "4.14.7"
- resolved "https://registry.yarnpkg.com/@vee-validate/yup/-/yup-4.14.7.tgz#a029151394ae4fbc7a038dbb49acc86f2ba78ddc"
- integrity sha512-sMLkSXbVWIFK0BE8gEp2Gcdd3aqpTggBjbkrYmcdgyHBeYoPmhBHhUpkXDFhmsckie2xv6lNTicGO5oJt71N1Q==
+"@vee-validate/yup@^4.15.0":
+ version "4.15.0"
+ resolved "https://registry.yarnpkg.com/@vee-validate/yup/-/yup-4.15.0.tgz#409f9b57414fadd5b86bc6ada18cd51a7ccd121c"
+ integrity sha512-paK2ZdxZJRrUGwqaqf7KMNC+n5C7UGs7DofK7wZCza/zKT/QtFSxVYgopGoYYrbAfd6DpVmNpf/ouBuRdPBthA==
dependencies:
type-fest "^4.8.3"
- vee-validate "4.14.7"
- yup "^1.3.2"
+ vee-validate "4.15.0"
"@vitejs/plugin-vue@5.1.4":
version "5.1.4"
@@ -7133,6 +7132,14 @@ vee-validate@4.14.7, vee-validate@^4.13.2:
"@vue/devtools-api" "^7.5.2"
type-fest "^4.8.3"
+vee-validate@4.15.0:
+ version "4.15.0"
+ resolved "https://registry.yarnpkg.com/vee-validate/-/vee-validate-4.15.0.tgz#eb77a9c867669d34abbc33ca5e16f2a991eb7ad5"
+ integrity sha512-PGJh1QCFwCBjbHu5aN6vB8macYVWrajbDvgo1Y/8fz9n/RVIkLmZCJDpUgu7+mUmCOPMxeyq7vXUOhbwAqdXcA==
+ dependencies:
+ "@vue/devtools-api" "^7.5.2"
+ type-fest "^4.8.3"
+
vite-node@2.1.8:
version "2.1.8"
resolved "https://registry.yarnpkg.com/vite-node/-/vite-node-2.1.8.tgz#9495ca17652f6f7f95ca7c4b568a235e0c8dbac5"
@@ -7518,7 +7525,7 @@ yocto-queue@^0.1.0:
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==
-yup@^1.3.2, yup@^1.4.0:
+yup@^1.6.1:
version "1.6.1"
resolved "https://registry.yarnpkg.com/yup/-/yup-1.6.1.tgz#8defcff9daaf9feac178029c0e13b616563ada4b"
integrity sha512-JED8pB50qbA4FOkDol0bYF/p60qSEDQqBD0/qeIrUCG1KbPBIQ776fCUNb9ldbPcSTxA69g/47XTo4TqWiuXOA==