@fy-/fws-vue 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,12 +26,17 @@ const rest = useRest();
|
|
|
26
26
|
const userStore = useUserStore();
|
|
27
27
|
const userData = computed(() => userStore.user);
|
|
28
28
|
const eventBus = useEventBus();
|
|
29
|
+
// Default date = 18y from now
|
|
30
|
+
const currentDate = new Date();
|
|
31
|
+
const defaultDate = new Date(
|
|
32
|
+
currentDate.setFullYear(currentDate.getFullYear() - 18),
|
|
33
|
+
);
|
|
29
34
|
const state = reactive({
|
|
30
35
|
userData: {
|
|
31
36
|
Username: userData.value?.UserProfile?.Username || "",
|
|
32
37
|
Gender: userData.value?.UserProfile?.Gender || "",
|
|
33
38
|
Bio: userData.value?.UserProfile?.Bio || "",
|
|
34
|
-
Birthdate: userData.value?.UserProfile?.Birthdate ||
|
|
39
|
+
Birthdate: userData.value?.UserProfile?.Birthdate || defaultDate,
|
|
35
40
|
PublicGender: userData.value?.UserProfile?.PublicGender || false,
|
|
36
41
|
PublicBio: userData.value?.UserProfile?.PublicBio || false,
|
|
37
42
|
PublicBirthdate: userData.value?.UserProfile?.PublicBirthdate || false,
|
|
@@ -44,9 +49,7 @@ watchEffect(() => {
|
|
|
44
49
|
Bio: userData.value?.UserProfile?.Bio || "",
|
|
45
50
|
Birthdate: userData.value?.UserProfile?.Birthdate
|
|
46
51
|
? new Date(userData.value?.UserProfile?.Birthdate.unixms)
|
|
47
|
-
|
|
48
|
-
.split("T")[0]
|
|
49
|
-
: "",
|
|
52
|
+
: defaultDate,
|
|
50
53
|
PublicGender: userData.value?.UserProfile?.PublicGender || false,
|
|
51
54
|
PublicBio: userData.value?.UserProfile?.PublicBio || false,
|
|
52
55
|
PublicBirthdate: userData.value?.UserProfile?.PublicBirthdate || false,
|
|
@@ -74,10 +77,11 @@ const patchUser = async () => {
|
|
|
74
77
|
const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
|
|
75
78
|
try {
|
|
76
79
|
const birtdateAtUnixms = birtdate.getTime();
|
|
77
|
-
//
|
|
80
|
+
// @ts-ignore
|
|
78
81
|
data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
|
|
79
82
|
} catch (e) {
|
|
80
83
|
const birtdateAtUnixms = new Date(birtdate).getTime();
|
|
84
|
+
// @ts-ignore
|
|
81
85
|
data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
|
|
82
86
|
}
|
|
83
87
|
// @ts-ignore
|
|
@@ -220,8 +224,8 @@ function selectFile(e: Event) {
|
|
|
220
224
|
v-model="state.userData.Birthdate"
|
|
221
225
|
class="mb-4"
|
|
222
226
|
type="datepicker"
|
|
223
|
-
:
|
|
224
|
-
|
|
227
|
+
:dp-options="{
|
|
228
|
+
format: 'yyyy-mm-dd',
|
|
225
229
|
}"
|
|
226
230
|
:label="$t('fws_birthdate_label')"
|
|
227
231
|
:error-vuelidate="v$.userData.Birthdate.$errors"
|
|
@@ -21,6 +21,10 @@ const props = withDefaults(
|
|
|
21
21
|
force18: false,
|
|
22
22
|
},
|
|
23
23
|
);
|
|
24
|
+
const currentDate = new Date();
|
|
25
|
+
const defaultDate = new Date(
|
|
26
|
+
currentDate.setFullYear(currentDate.getFullYear() - 18),
|
|
27
|
+
);
|
|
24
28
|
const ageValidator = (value: any) => {
|
|
25
29
|
const today = new Date();
|
|
26
30
|
const birthDate = new Date(value);
|
|
@@ -36,7 +40,7 @@ const state = reactive({
|
|
|
36
40
|
userData: {
|
|
37
41
|
Username: userData.value?.UserProfile?.Username || "",
|
|
38
42
|
Gender: userData.value?.UserProfile?.Gender || "",
|
|
39
|
-
Birthdate: userData.value?.UserProfile?.Birthdate ||
|
|
43
|
+
Birthdate: userData.value?.UserProfile?.Birthdate || defaultDate,
|
|
40
44
|
AcceptedTerms: userData.value?.AcceptedTerms || true,
|
|
41
45
|
},
|
|
42
46
|
});
|
|
@@ -46,9 +50,7 @@ watchEffect(() => {
|
|
|
46
50
|
Gender: userData.value?.UserProfile?.Gender || "",
|
|
47
51
|
Birthdate: userData.value?.UserProfile?.Birthdate
|
|
48
52
|
? new Date(userData.value?.UserProfile?.Birthdate.unixms)
|
|
49
|
-
|
|
50
|
-
.split("T")[0]
|
|
51
|
-
: "",
|
|
53
|
+
: defaultDate,
|
|
52
54
|
AcceptedTerms: userData.value?.AcceptedTerms || true,
|
|
53
55
|
};
|
|
54
56
|
});
|
|
@@ -84,10 +86,11 @@ const patchUser = async () => {
|
|
|
84
86
|
const birtdate = new Date(`${data.Birthdate}T00:00:00Z`);
|
|
85
87
|
try {
|
|
86
88
|
const birtdateAtUnixms = birtdate.getTime();
|
|
87
|
-
//
|
|
89
|
+
// @ts-ignore
|
|
88
90
|
data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
|
|
89
91
|
} catch (e) {
|
|
90
92
|
const birtdateAtUnixms = new Date(birtdate).getTime();
|
|
93
|
+
// @ts-ignore
|
|
91
94
|
data.Birthdate = new Date(birtdateAtUnixms).toISOString().split("T")[0];
|
|
92
95
|
}
|
|
93
96
|
const response = await rest("User/_ForceProfile", "PATCH", data);
|
|
@@ -132,8 +135,8 @@ const patchUser = async () => {
|
|
|
132
135
|
id="birthdateFWS"
|
|
133
136
|
v-model="state.userData.Birthdate"
|
|
134
137
|
class="mb-4"
|
|
135
|
-
:
|
|
136
|
-
|
|
138
|
+
:dp-options="{
|
|
139
|
+
format: 'yyyy-mm-dd',
|
|
137
140
|
}"
|
|
138
141
|
type="datepicker"
|
|
139
142
|
:label="$t('fws_birthdate_label')"
|