# Date field becomes empty when focus is changed

**URL:** https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081
**Category:** Developer
**Created:** [January 25, 2019, 10:55am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081 "2019-01-25T10:55:36Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![prak](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/prak/32/321_2.png) [@prak](https://discuss.tryton.org/u/prak)
#### Post date: [January 25, 2019, 10:55am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/1 "2019-01-25T10:55:36Z")

</div>

I am facing a problem in using the Tryton Client. I created a date field in my customized module. As soon as enter the date and the focus is shifted from the date field, it becomes empty. I am facing this problem in Tryton GTK client and not when using Sao. I am running Tryton client version 5.0.5 on Ubuntu 18.04.

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [January 25, 2019, 11:55am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/2 "2019-01-25T11:55:53Z")

</div>

Are you sure to enter a date with a correct format? If the parser can not parse it, it just remove the content.

---

<div class="post-metadata">

### Author: ![prak](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/prak/32/321_2.png) [@prak](https://discuss.tryton.org/u/prak)
#### Post date: [January 28, 2019, 6:03am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/3 "2019-01-28T06:03:13Z")

</div>

I am using the Date wizard to use this. Please see the link here - [https://www.dropbox.com/s/ua9pblkxmx95oow/Tryton\_Client\_Date\_Issue-2019-01-28\_11.20.34.mkv](https://www.dropbox.com/s/ua9pblkxmx95oow/Tryton_Client_Date_Issue-2019-01-28_11.20.34.mkv).

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [January 28, 2019, 8:09am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/4 "2019-01-28T08:09:52Z")

</div>

It looks like you system is using a very weird date format with week day. I guess dateutil parser can not parse it. Could you try with a more standard date format? If it is the problem, I think we should fill an issue to improve this behavior. We could try before parsing with dateutil, to parse with the `datetime.strptime` for strict matching.

---

<div class="post-metadata">

### Author: ![prak](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/prak/32/321_2.png) [@prak](https://discuss.tryton.org/u/prak)
#### Post date: [January 29, 2019, 6:08am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/5 "2019-01-29T06:08:02Z")

</div>

Ok let me try it and then I will let you know with the progress.

---

<div class="post-metadata">

### Author: ![prak](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/prak/32/321_2.png) [@prak](https://discuss.tryton.org/u/prak)
#### Post date: [February 7, 2019, 10:37am UTC](https://discuss.tryton.org/t/date-field-becomes-empty-when-focus-is-changed/1081/6 "2019-02-07T10:37:56Z")

</div>

@ced The issue is due to a code in tryton/common.py. I have raised the issue. Ref - [Date field becomes empty when focus is changed (#8087) · Issues · Tryton / Tryton · GitLab](https://bugs.tryton.org/issue8087).
