Skip to content

Commit

Permalink
fix date format on the client #253
Browse files Browse the repository at this point in the history
  • Loading branch information
beesaferoot committed Dec 22, 2024
1 parent 3f99e77 commit aacbeb2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/backend/app/Services/PersonService.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,12 @@ public function isMaintenancePerson($customerType): bool {
}

public function createPersonDataFromRequest(Request $request): array {
$birthDate = Carbon::parse($request->get('birth_date'))->format('Y-m-d H:i:s');

return [
'title' => $request->get('title'),
'education' => $request->get('education'),
'name' => $request->get('name'),
'surname' => $request->get('surname'),
'birth_date' => $birthDate,
'birth_date' => $request->get('birth_date'),
'sex' => $request->get('sex'),
'is_customer' => $request->get('is_customer') ?? 0,
];
Expand Down
7 changes: 3 additions & 4 deletions src/frontend/src/Helpers/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ export const convertObjectKeysToSnakeCase = (obj) => {
for (const [key, value] of Object.entries(obj)) {
const snakeKey = camelToSnake(key)

if (value instanceof Date) {
result[snakeKey] = value
} else if (
if (
value !== null &&
typeof value === "object" &&
typeof value === "object" &&
value instanceof Date === false &&
!Array.isArray(value)
) {
result[snakeKey] = convertObjectKeysToSnakeCase(value)
Expand Down
5 changes: 4 additions & 1 deletion src/frontend/src/modules/Client/AddClientModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ import { notify } from "@/mixins"
import { PersonService } from "@/services/PersonService"
import { CityService } from "@/services/CityService"
import Loader from "@/shared/Loader.vue"
import moment from "moment"
export default {
name: "AddClientModal",
Expand Down Expand Up @@ -283,7 +284,9 @@ export default {
isPrimary: true,
title: this.personService.person.title,
education: this.personService.person.education,
birthDate: this.personService.person.birthDate,
birthDate: moment(this.personService.person.birthDate).format(
"YYYY-MM-DD HH:mm:ss",
),
sex: this.personService.person.gender,
isCustomer: true,
}
Expand Down

0 comments on commit aacbeb2

Please sign in to comment.