Compare dates
Fix problem_1
```
	@hybrid_method
	def is_valid(self):
		return (self.not_after > datetime.now()) & (self.not_before < datetime.now())
```
`Cert.select().where(Cert.is_valid() == True)` Here is perhaps a cleaner way of implementing `is_valid()`:

```python

    @hybrid_property
    def is_valid(cls):
        n = datetime.datetime.now()
        return self.not_before <= n <= self.not_after

    @is_valid.expression
    def is_valid(self):
        now = SQL('current_timestamp')
        return (self.not_before <= now) & (self.not_after >= now)
```

As far as "valid_for", you can pass a `datetime.timedelta` to Peewee and it should do the right thing:

```python

    @hybrid_property
    def valid_for(self):
        return (self.not_after - datetime.datetime.now()).days

    @valid_for.expression
    def valid_for(self):
        return fn.AGE(self.end)

query = Cert.select().where(Cert.valid_for > datetime.timedelta(days=99))
```

Does that address your problem? Also note you do not need to write "== True" in your expressions. @coleifer Thank you :)
My model:

```
class Cert(db.Model):
    not_before = DateTimeField();
    not_after = DateTimeField();

    @hybrid_property
    def is_valid(self):
        return True if (self.not_after > datetime.now()) and (self.not_before <= datetime.now()) else False

    @hybrid_property
    def valid_for(self):
        return (self.not_after - datetime.now()).days

    @valid_for.expression
    def valid_for(cls):
        return fn.AGE(cls.not_after)

    @is_valid.expression
    def is_valid(cls):
        return True if (cls.not_after - fn.SELECT(SQL('localtimestamp')) > 0) and (fn.SELECT(SQL('localtimestamp') - cls.not_before) <= 0) else False
```

I use expression based on "virtual" fields.
1st problem:

```
query = Cert.select().where(Cert.is_valid == True)
('SELECT "t1"."id", "t1"."not_before", "t1"."not_after"  FROM "cert" AS "t1" WHERE %s', [True])
```

2nd problem:
```
query = Cert.select().where(Cert.valid_for > 99)
('SELECT "t1"."id", "t1"."not_before", "t1"."not_after" FROM "cert" AS "t1" WHERE (AGE("t1"."not_after") > %s)', [99])
No operator matches the given name and argument type(s). You might need to add explicit type casts.
```
99 is int. How I can set it as postgresql interval? (interval '99 day')

Where is my mistakes?