diff --git a/mixbox/dates.py b/mixbox/dates.py
index be279e1..794e0b0 100644
--- a/mixbox/dates.py
+++ b/mixbox/dates.py
@@ -73,10 +73,10 @@ def serialize_date(value):
     """
     if not value:
         return None
-    elif isinstance(value, datetime.date):
-        return value.isoformat()
     elif isinstance(value, datetime.datetime):
         return value.date().isoformat()
+    elif isinstance(value, datetime.date):
+        return value.isoformat()
     else:
         return parse_date(value).isoformat()
 
diff --git a/mixbox/fields.py b/mixbox/fields.py
index f623c6b..cad106a 100644
--- a/mixbox/fields.py
+++ b/mixbox/fields.py
@@ -373,7 +373,7 @@ class DateField(TypedField):
         return serialize_date(value)
 
     def binding_value(self, value):
-        return serialize_datetime(value)
+        return serialize_date(value)
 
 
 class CDATAField(TypedField):

DateField does not properly serialize datetime objects
When storing a Python `datetime` object in a property specified by a `DateField`, the value incorrectly serializes to an ISO timestamp (`YYYY-MM-DDThh:mm:ss`) instead of to a `xs:date` format (`YYYY-MM-DD`).

    class Foo(Entity):
        my_date = DateField("my_date");

    obj = Foo()
    obj.my_date = datetime.datetime.now()

There are two issues:

* the `DateField::binding_value` function uses `serialize_datetime` instead of `serialize_date`

* the `serialize_date` function erroneously includes time information in its output when processing datetimes
diff --git a/tests/dates_tests.py b/tests/dates_tests.py
index f139939..d3be86b 100644
--- a/tests/dates_tests.py
+++ b/tests/dates_tests.py
@@ -15,6 +15,12 @@ class DatesTests(unittest.TestCase):
         dstr = "2015-04-01"
         parsed = dates.parse_date(dstr)
         self.assertEqual(dstr, parsed.isoformat())
+        
+    def test_serialize_datetime_as_date(self):
+        now = dates.now()
+        self.assertTrue(isinstance(now, datetime.datetime))
+        nowstr = dates.serialize_date(now)
+        self.assertEquals(nowstr, now.date().isoformat())
 
     def test_parse_datetime(self):
         dtstr = '2015-04-02T16:44:30.423149+00:00'

pip install -e .[docs,test]
parse_log_pytest
requirements.txt
nose pytest
3.9
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
babel==2.17.0
bump2version==1.0.1
bumpversion==0.6.0
distlib==0.3.9
docutils==0.21.2
exceptiongroup==1.2.2
filelock==3.18.0
iniconfig==2.1.0
Jinja2==3.1.6
lxml==5.3.1
MarkupSafe==3.0.2
-e git+https://github.com/CybOXProject/mixbox.git@bab51cfd20757f9a64a61571631203dbbc3644f8#egg=mixbox
nose==1.3.0
ordered-set==4.1.0
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
py==1.11.0
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.8
tomli==2.2.1
tox==1.6.1
virtualenv==20.30.0

name: mixbox
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - babel==2.17.0
      - bump2version==1.0.1
      - bumpversion==0.6.0
      - distlib==0.3.9
      - docutils==0.21.2
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - iniconfig==2.1.0
      - jinja2==3.1.6
      - lxml==5.3.1
      - markupsafe==3.0.2
      - nose==1.3.0
      - ordered-set==4.1.0
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - py==1.11.0
      - pygments==2.19.1
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==1.3.1
      - sphinx-rtd-theme==0.1.8
      - tomli==2.2.1
      - tox==1.6.1
      - virtualenv==20.30.0
prefix: /opt/conda/envs/mixbox

tests/dates_tests.py::DatesTests::test_serialize_datetime_as_date
tests/dates_tests.py::DatesTests::test_now tests/dates_tests.py::DatesTests::test_parse_date tests/dates_tests.py::DatesTests::test_parse_date_none tests/dates_tests.py::DatesTests::test_parse_datetime tests/dates_tests.py::DatesTests::test_parse_datetime_none tests/dates_tests.py::DatesTests::test_serialize_date tests/dates_tests.py::DatesTests::test_serialize_datetime
mixbox/fields.py mixbox/dates.py
mixbox/fields.py mixbox/dates.py