From 2f0a8064c2c370e2a1b8823564db0cbdac7f9126 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 4 May 2022 14:36:04 +0200 Subject: [PATCH] (ui) remove workaround --- .../javascript/components/user/user-profile-form.tsx | 12 +----------- app/frontend/src/javascript/controllers/members.js | 3 --- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/app/frontend/src/javascript/components/user/user-profile-form.tsx b/app/frontend/src/javascript/components/user/user-profile-form.tsx index b65aa0e5a..8e74c8c4a 100644 --- a/app/frontend/src/javascript/components/user/user-profile-form.tsx +++ b/app/frontend/src/javascript/components/user/user-profile-form.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import { react2angular } from 'react2angular'; import { SubmitHandler, useForm, useWatch } from 'react-hook-form'; import { isNil as _isNil } from 'lodash'; @@ -14,8 +14,6 @@ import { FormSwitch } from '../form/form-switch'; import { FormRichText } from '../form/form-rich-text'; import MemberAPI from '../../api/member'; import { AvatarInput } from './avatar-input'; -import moment from 'moment'; -import { TDateISODate } from '../../typings/date-iso'; import { FabButton } from '../base/fab-button'; declare const Application: IApplication; @@ -39,14 +37,6 @@ export const UserProfileForm: React.FC = ({ action, size, const { handleSubmit, register, control, formState, setValue } = useForm({ defaultValues: { ...user } }); const output = useWatch({ control }); - useEffect(() => { - // this is a workaround needed because something in angular.js is transforming the YYY-MM-DD string to a Date Object - setValue( - 'statistic_profile_attributes.birthday', - moment(user.statistic_profile_attributes.birthday).format('YYYY-MM-DD') as TDateISODate - ); - }, [user]); - const [isOrganization, setIsOrganization] = React.useState(!_isNil(user.invoicing_profile_attributes.organization_attributes)); /** diff --git a/app/frontend/src/javascript/controllers/members.js b/app/frontend/src/javascript/controllers/members.js index 1a8389322..c063cebab 100644 --- a/app/frontend/src/javascript/controllers/members.js +++ b/app/frontend/src/javascript/controllers/members.js @@ -302,9 +302,6 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco const initialize = function () { CSRF.setMetaTags(); - // init the birth date to JS object - $scope.user.statistic_profile_attributes.birthday = moment($scope.user.statistic_profile_attributes.birthday).toDate(); - if ($scope.activeProvider.providable_type !== 'DatabaseProvider') { $scope.preventPassword = true; }