diff --git a/packages/frontend/src/components/MkInput.vue b/packages/frontend/src/components/MkInput.vue index a51a97efe..9918a3ff6 100644 --- a/packages/frontend/src/components/MkInput.vue +++ b/packages/frontend/src/components/MkInput.vue @@ -62,7 +62,7 @@ const props = defineProps<{ step?: any; datalist?: string[]; min?: number; - max?: number; + max?: number | string; inline?: boolean; debounce?: boolean; manualSave?: boolean; diff --git a/packages/frontend/src/pages/settings/profile.vue b/packages/frontend/src/pages/settings/profile.vue index 6d557aced..10705cfa0 100644 --- a/packages/frontend/src/pages/settings/profile.vue +++ b/packages/frontend/src/pages/settings/profile.vue @@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + @@ -134,6 +134,14 @@ const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.d const reactionAcceptance = computed(defaultStore.makeGetterSetter('reactionAcceptance')); +const now = new Date(); + +const setMaxBirthDate = () => { + const y = now.getFullYear(); + + return `${y}-12-31`; +}; + const profile = reactive({ name: $i.name, description: $i.description, @@ -178,6 +186,13 @@ function saveFields() { } function save() { + if (profile.birthday && profile.birthday > setMaxBirthDate()) { + os.alert({ + type: 'warning', + text: 'You can\'t set your birthday to the future', + }); + return undefined; + } os.apiWithDialog('i/update', { // 空文字列をnullにしたいので??は使うな // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing