API & Client: profile edition refactor

This commit is contained in:
Sam 2018-05-08 18:26:42 +02:00
parent d6bb413fb6
commit faefe18e04
3 changed files with 3 additions and 5 deletions

View File

@ -429,7 +429,7 @@ def test_user_profile_valid_update(app):
last_name='Doe', last_name='Doe',
location='Somewhere', location='Somewhere',
bio='just a random guy', bio='just a random guy',
birth_date='01/01/1980' birth_date='1980-01-01'
)), )),
headers=dict( headers=dict(
Authorization='Bearer ' + json.loads( Authorization='Bearer ' + json.loads(

View File

@ -207,7 +207,7 @@ def edit_user(user_id):
user.bio = bio user.bio = bio
user.location = location user.location = location
user.birth_date = ( user.birth_date = (
datetime.datetime.strptime(birth_date, '%d/%m/%Y') datetime.datetime.strptime(birth_date, '%Y-%m-%d')
if birth_date if birth_date
else None else None
) )

View File

@ -120,9 +120,7 @@ class ProfileEdit extends React.Component {
<input <input
name="birthDate" name="birthDate"
className="form-control input-lg" className="form-control input-lg"
type="text" type="date"
pattern="\d{1,2}/\d{1,2}/\d{4}"
placeholder="dd/mm/yyyy"
value={formProfile.birthDate} value={formProfile.birthDate}
onChange={onHandleFormChange} onChange={onHandleFormChange}
/> />