# How to use current date in a domain in XML

**URL:** https://discuss.tryton.org/t/how-to-use-current-date-in-a-domain-in-xml/4939
**Category:** Developer
**Created:** [January 20, 2022, 10:02pm UTC](https://discuss.tryton.org/t/how-to-use-current-date-in-a-domain-in-xml/4939 "2022-01-20T22:02:20Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rvalery](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/rvalery/32/1533_2.png) [@rvalery](https://discuss.tryton.org/u/rvalery)
#### Post date: [January 20, 2022, 10:02pm UTC](https://discuss.tryton.org/t/how-to-use-current-date-in-a-domain-in-xml/4939/1 "2022-01-20T22:02:20Z")

</div>

Hello everyone.  
I’m trying to create a domain that compares a field with the current date. This is what I have tested so far in my xml :

```auto
        <record model="ir.action.act_window.domain" id="act_invoicing_element_not_invoiced">
            <field name="name">Not Invoiced</field>
            <field name="sequence" eval="1"/>
            <field name="domain" eval="[('mission_order', '!=', None), ('invoiced', '=', False), ('date', '<', Date())]" pyson="1"/>
            <field name="count" eval="True"/>
            <field name="act_window" ref="act_invoicing_element"/>
        </record>

```

But tryton does not like the Date() part and displays an error when I try to update my module :  
`Exception: Error in Tag record with id transport.act_invoicing_element_not_invoiced.`  
I have seen on [this topic](https://discuss.tryton.org/t/how-to-write-current-time-comparing-domain-for-xml/3643) that you can use DateTime(), but does anybody know if Date() also works ? How should I write my domain ?

---

<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 20, 2022, 10:29pm UTC](https://discuss.tryton.org/t/how-to-use-current-date-in-a-domain-in-xml/4939/2 "2022-01-20T22:29:17Z")

</div>

`Date` is a valid PYSON. I suspect that the error is somewhere else but it is not possible as you did not provide the full traceback.

---

<div class="post-metadata">

### Author: ![rvalery](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/rvalery/32/1533_2.png) [@rvalery](https://discuss.tryton.org/u/rvalery)
#### Post date: [January 20, 2022, 11:31pm UTC](https://discuss.tryton.org/t/how-to-use-current-date-in-a-domain-in-xml/4939/3 "2022-01-20T23:31:36Z")

</div>

Indeed the problem was not with `Date()`, but with the ‘\<’ character, that should be escaped, as you explained on this page [Problem with pyson, domain, and xml (google.com)](https://groups.google.com/g/tryton/c/N3l7hE-zxkQ)  
The correct syntax should be :

```auto
<field name="domain" eval="[('mission_order', '!=', None), ('invoiced', '=', False), ('date', '&lt;', Date())]" pyson="1"/>

```

With this syntax I don’t have an error when I try to update my module.

Thanks @ced
