Skip to content

Commit

Permalink
Fix customer creation birthdate bug #253 (#425)
Browse files Browse the repository at this point in the history
* Fix customer creation bug #253

- Correctly parse birthdate data gotten from the frontend
- Fix util function to allow date values

* fix date format on the client #253
  • Loading branch information
beesaferoot authored Dec 23, 2024
1 parent 3f28bd6 commit fe053be
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/frontend/src/Helpers/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ export const convertObjectKeysToSnakeCase = (obj) => {
for (const [key, value] of Object.entries(obj)) {
const snakeKey = camelToSnake(key)

if (value !== null && typeof value === "object" && !Array.isArray(value)) {
if (
value !== null &&
typeof value === "object" &&
value instanceof Date === false &&
!Array.isArray(value)
) {
result[snakeKey] = convertObjectKeysToSnakeCase(value)
} else if (Array.isArray(value)) {
result[snakeKey] = value?.map((item) =>
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 fe053be

Please sign in to comment.