Skip to content

Commit

Permalink
BC-7000.- set backend birthday in expected format
Browse files Browse the repository at this point in the history
  • Loading branch information
virgilchiriac committed Apr 2, 2024
1 parent 9fbb58e commit 01c6c43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pages/administration/StudentOverview.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
:current-page="page"
>
<template #datacolumn-birthday="{ data }">
<span class="text-content">{{ data ? printDate(data) : "" }}</span>
<span class="text-content">{{ printDate(data) }}</span>
</template>
<template #datacolumn-classes="{ data }">
{{ (data || []).join(", ") }}
Expand Down
8 changes: 6 additions & 2 deletions src/plugins/datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const printDateFromDeUTC = (date) => {
*/
export const inputDateFromDeUTC = (date) => {
if (date) {
const result = dayjs.tz(date, "UTC");
const result = dayjs.tz(date, "DD.MM.YYYY", "UTC");
return result.format(DATETIME_FORMAT.inputDate);
}
return null;
Expand All @@ -150,7 +150,11 @@ export const inputDateFormat = (date) => {
* @return {String} Date string based on current timezone using locale date formating
*/
export const printDate = (date) => {
return fromUTC(date).format(DATETIME_FORMAT.date);
if (date) {
const result = fromUTC(date).format(DATETIME_FORMAT.date);
return result;
}
return null;
};

/**
Expand Down
2 changes: 2 additions & 0 deletions src/store/bulkConsent.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import generatePassword from "@/mixins/generatePassword";
import { $axios } from "@/utils/api";
import { inputDateFormat } from "@/plugins/datetime";

export const actions = {
/**
Expand Down Expand Up @@ -77,6 +78,7 @@ export const actions = {
.map((student) => {
student.fullName = student.firstName + " " + student.lastName;
student.password = generatePassword();
student.birthday = inputDateFormat(student.birthday);
return student;
});
commit("setStudentsData", data);
Expand Down

0 comments on commit 01c6c43

Please sign in to comment.