title: Datetime format for piecash transaction
body: <p>I´m working on a very simple code to write a transaction to GNU Cash book using piecash. I´m having problems with the date format. Here is the code:</p>
  <pre><code>from collections import defaultdict
  import piecash
  import datetime
  
  gnubook = 'E:\\piecash_test\\teste.gnucash'
  book = piecash.open_book(gnubook, readonly=False, do_backup=False)
  
  p_date = datetime.datetime(2020, 12, 26)
  #p_date = datetime.date(2020, 12, 26)
  
  broker = book.accounts(name=&quot;Broker account&quot;)
  dest = book.accounts(name=&quot;AAPL&quot;)
  
  
  inj_tr = piecash.Transaction(   currency=book.default_currency,
                                  description='Transaction Description',
                                  post_date=p_date,
                                  splits=[
                                      piecash.Split(  account=dest,
                                                      value=1000,
                                                      quantity=100,
                                                      memo='Transaction destination memo'),
                                      piecash.Split(  account=broker,
                                                      value=-1000,
                                                      memo='Transaction broker memo'),
                                  ])
  book.save()
  </code></pre>
  <p>The problem is with the p_date variable. If a use:</p>
  <pre><code>p_date = datetime.datetime(2020, 12, 26)
  </code></pre>
  <p>I receive the following error from piecash:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1204, in _execute_context
      context = constructor(dialect, self, conn, *args)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\default.py&quot;, line 855, in _init_compiled
      param.append(processors[key](compiled_params[key]))
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\sql\type_api.py&quot;, line 1227, in process
      return impl_processor(process_param(value, dialect))
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\piecash\sa_extra.py&quot;, line 135, in process_bind_param
      assert isinstance(value, datetime.date) and not isinstance(value, datetime.datetime), \
  AssertionError: value 2020-12-26 00:00:00 is not of type datetime.date but type &lt;class 'datetime.datetime'&gt;
  The above exception was the direct cause of the following exception:
  Traceback (most recent call last):
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\session.py&quot;, line 2540, in flush
      self._flush(objects)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\session.py&quot;, line 2682, in _flush
      transaction.rollback(_capture_exception=True)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\util\langhelpers.py&quot;, line 68, in __exit__
      compat.raise_(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\util\compat.py&quot;, line 182, in raise_
      raise exception
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\session.py&quot;, line 2642, in _flush
      flush_context.execute()
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py&quot;, line 422, in execute
      rec.execute(self)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py&quot;, line 586, in execute
      persistence.save_obj(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\persistence.py&quot;, line 239, in save_obj
      _emit_insert_statements(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\persistence.py&quot;, line 1135, in _emit_insert_statements
      result = cached_connections[connection].execute(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1011, in execute
      return meth(self, multiparams, params)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\sql\elements.py&quot;, line 298, in _execute_on_connection
      return connection._execute_clauseelement(self, multiparams, params)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1124, in _execute_clauseelement
      ret = self._execute_context(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1206, in _execute_context
      self._handle_dbapi_exception(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1510, in _handle_dbapi_exception
      util.raise_(
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\util\compat.py&quot;, line 182, in raise_
      raise exception
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\base.py&quot;, line 1204, in _execute_context
      context = constructor(dialect, self, conn, *args)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\engine\default.py&quot;, line 855, in _init_compiled
      param.append(processors[key](compiled_params[key]))
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\sql\type_api.py&quot;, line 1227, in process
      return impl_processor(process_param(value, dialect))
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\piecash\sa_extra.py&quot;, line 135, in process_bind_param
      assert isinstance(value, datetime.date) and not isinstance(value, datetime.datetime), \
  sqlalchemy.exc.StatementError: (builtins.AssertionError) value 2020-12-26 00:00:00 is not of type datetime.date but type &lt;class 'datetime.datetime'&gt;
  [SQL: INSERT INTO transactions (guid, currency_guid, num, post_date, enter_date, description) VALUES (?, ?, ?, ?, ?, ?)]
  [parameters: [{'post_date': datetime.datetime(2020, 12, 26, 0, 0), 'enter_date': datetime.datetime(2020, 12, 26, 12, 37, 10), 'description': 'Transaction Description', 'num': '', 'currency_guid': None}]]
  </code></pre>
  <p>But, using the format <code>p_date = datetime.date(2020, 12, 26)</code>, the error changes to:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\util\compat.py&quot;, line 182, in raise_
      raise exception
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\sqlalchemy\orm\state.py&quot;, line 430, in _initialize_instance
      return manager.original_init(*mixed[1:], **kwargs)
    File &quot;E:\piecash_test\piecash\venv\lib\site-packages\piecash\core\transaction.py&quot;, line 244, in __init__
      raise GncValidationError(&quot;post_date should be a date object&quot;)
  piecash._common.GncValidationError: post_date should be a date object
  </code></pre>
  <p>I know the problem is related to if the variable is a <code>type</code> of <code>datetime</code> or if it is an <code>instance</code> of it, but I´m unable to solve it.
  Can someone give me a hand?
  Thanks</p>