mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-24 05:05:20 -04:00
(bugfix)(editor) birthday widget disabled wrong date range
This commit is contained in:
parent
8ec65b87d4
commit
fe026d7ded
@ -564,9 +564,13 @@ export default link.extend({
|
||||
};
|
||||
},
|
||||
data() {
|
||||
const bdayRange = birthdateRange(this.$config);
|
||||
return {
|
||||
saving: false,
|
||||
disabledDates: birthdateRange(this.$config),
|
||||
disabledDates: {
|
||||
to: bdayRange.min,
|
||||
from: bdayRange.max,
|
||||
},
|
||||
propagate: [] as string[],
|
||||
defaultOpinions: opinionsToForm(opinions, this.$translator),
|
||||
isValidLink,
|
||||
|
@ -539,7 +539,7 @@ const cleanupBirthday = (bd) => {
|
||||
}
|
||||
|
||||
bd = new Date(parseInt(match[1]), parseInt(match[2]) - 1, parseInt(match[3]));
|
||||
if (bd < birthdateRange(global.config).from || bd > birthdateRange(global.config).to) {
|
||||
if (bd < birthdateRange(global.config).min || bd > birthdateRange(global.config).max) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -2,10 +2,10 @@ import type { Config } from '../locale/config.ts';
|
||||
|
||||
const today = new Date();
|
||||
|
||||
export const birthdateRange = (config: Config): { from: Date, to: Date } => {
|
||||
export const birthdateRange = (config: Config): { min: Date, max: Date } => {
|
||||
return {
|
||||
from: new Date(1900, 0, 1),
|
||||
to: new Date(today.getFullYear() - (config.ageLimit || 13), today.getMonth(), today.getDate()),
|
||||
min: new Date(1900, 0, 1),
|
||||
max: new Date(today.getFullYear() - (config.ageLimit || 13), today.getMonth(), today.getDate()),
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user