How to work with date type?
benvindo opened this issue · comments
Bruno Costa commented
Hi, someone gives me example, how can I use the date type to save and load with minidb?
Thomas Perl commented
You should be able to use datetime.datetime
, datetime.date
and datetime.time
, as these all have converters already pre-defined.
import datetime
class Something(minidb.Model):
name = str
birthday = datetime.date
favorite_time_of_day = datetime.time
last_login = datetime.datetime
The definitions are here:
https://github.com/thp/minidb/blob/master/minidb.py#L781
https://github.com/thp/minidb/blob/master/minidb.py#L797
https://github.com/thp/minidb/blob/master/minidb.py#L811