diff --git a/bokeh/util/serialization.py b/bokeh/util/serialization.py
index 96c406a88..dd6d27e78 100644
--- a/bokeh/util/serialization.py
+++ b/bokeh/util/serialization.py
@@ -101,7 +101,8 @@ def convert_datetime_type(obj):
 
     # Datetime (datetime is a subclass of date)
     elif isinstance(obj, dt.datetime):
-        return (obj - DT_EPOCH).total_seconds() * 1000. + obj.microsecond / 1000.
+        diff = obj.replace(tzinfo=None) - DT_EPOCH
+        return diff.total_seconds() * 1000. + obj.microsecond / 1000.
 
     # Timedelta (timedelta is class in the datetime library)
     elif isinstance(obj, dt.timedelta):

bokeh.util.serialization.py  convert_datetime_type breaks when passed timezone aware datetime
After updating to bokeh 0.12.6 the convert_datetime_type became unable to handle datetime objecs that are timezone aware.  The subtraction of DT_EPOCH which is a naive datetime from a obj which might be aware or naive fails when obj is timezone aware.    The error indicates that subtraction of a datetime object and a naive object is not supported.

This occurs with python 2.7.

proposed fix to serialization.py attached.

$ pip freeze
appdirs==1.4.3
awsebcli==3.7.7
backports-abc==0.4
backports.ssl-match-hostname==3.5.0.1
bkcharts==0.2
blessed==1.9.5
bokeh==0.12.6
botocore==1.4.40
cement==2.8.2
certifi==2016.2.28
colorama==0.3.7
cycler==0.10.0
DateTime==4.1.1
Django==1.9.8
docker-py==1.7.2
dockerpty==0.4.1
docopt==0.6.2
docutils==0.12
futures==3.0.5
Jinja2==2.8
jmespath==0.9.0
MarkupSafe==0.23
msgpack-python==0.4.8
numpy==1.11.1
packaging==16.8
pandas==0.18.1
pathspec==0.3.4
pyasn1==0.1.9
pygobject==3.18.2
pyparsing==2.1.5
python-dateutil==2.5.3
pytz==2016.6.1
PyYAML==3.11
requests==2.9.1
rsa==3.4.2
s3transfer==0.0.1
semantic-version==2.5.0
singledispatch==3.4.0.3
six==1.10.0
tabulate==0.7.5
td-client==0.5.0
termcolor==1.1.0
texttable==0.8.4
tornado==4.4.1
tzlocal==1.2.2
urllib3==1.17
virtualenv==15.0.2
wcwidth==0.1.7
websocket-client==0.37.0
zope.interface==4.2.0

[serialization.py.txt](https://github.com/bokeh/bokeh/files/1078483/serialization.py.txt)
 

diff --git a/bokeh/util/tests/test_serialization.py b/bokeh/util/tests/test_serialization.py
index c664a5c9a..501f2f679 100644
--- a/bokeh/util/tests/test_serialization.py
+++ b/bokeh/util/tests/test_serialization.py
@@ -6,6 +6,7 @@ import base64
 import pytest
 import numpy as np
 import pandas as pd
+import pytz
 
 import bokeh.util.serialization as bus
 
@@ -60,6 +61,12 @@ def test_convert_datetime_type():
     assert bus.convert_datetime_type(pd.Timedelta("3000ms")) == 3000.0
     assert bus.convert_datetime_type(bus._pd_timestamp(3000000)) == 3.0
 
+def test_convert_datetime_type_with_tz():
+    # This ensures datetimes are sent to BokehJS timezone-naive
+    # see https://github.com/bokeh/bokeh/issues/6480
+    for tz in pytz.all_timezones:
+        assert bus.convert_datetime_type(datetime.datetime(2016, 5, 11, tzinfo=datetime.tzinfo(tz))) == 1462924800000.0
+
 testing = [[float('nan'), 3], [float('-inf'), [float('inf')]]]
 expected = [['NaN', 3.0], ['-Infinity', ['Infinity']]]
 

pip install bokeh
parse_log_pytest
pytest
pytest
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
bokeh==3.4.3
contourpy==1.3.0
exceptiongroup @ file:///croot/exceptiongroup_1706031385326/work
iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work
Jinja2==3.1.6
MarkupSafe==3.0.2
numpy==2.0.2
packaging @ file:///croot/packaging_1734472117206/work
pandas==2.2.3
pillow==11.1.0
pluggy @ file:///croot/pluggy_1733169602837/work
pytest @ file:///croot/pytest_1738938843180/work
python-dateutil==2.9.0.post0
pytz==2025.2
PyYAML==6.0.2
six==1.17.0
tomli @ file:///opt/conda/conda-bld/tomli_1657175507142/work
tornado==6.4.2
tzdata==2025.2
xyzservices==2025.1.0

name: bokeh
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
  - exceptiongroup=1.2.0=py39h06a4308_0
  - iniconfig=1.1.1=pyhd3eb1b0_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
  - packaging=24.2=py39h06a4308_0
  - pip=25.0=py39h06a4308_0
  - pluggy=1.5.0=py39h06a4308_0
  - pytest=8.3.4=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
  - tomli=2.0.1=py39h06a4308_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - bokeh==3.4.3
      - contourpy==1.3.0
      - jinja2==3.1.6
      - markupsafe==3.0.2
      - numpy==2.0.2
      - pandas==2.2.3
      - pillow==11.1.0
      - python-dateutil==2.9.0.post0
      - pytz==2025.2
      - pyyaml==6.0.2
      - six==1.17.0
      - tornado==6.4.2
      - tzdata==2025.2
      - xyzservices==2025.1.0
prefix: /opt/conda/envs/bokeh

bokeh/util/tests/test_serialization.py::test_convert_datetime_type_with_tz
bokeh/util/tests/test_serialization.py::test_array_encoding_disabled_by_dtype
bokeh/util/tests/test_serialization.py::test_id bokeh/util/tests/test_serialization.py::test_id_with_simple_ids bokeh/util/tests/test_serialization.py::test_np_consts bokeh/util/tests/test_serialization.py::test_binary_array_types bokeh/util/tests/test_serialization.py::test_datetime_types bokeh/util/tests/test_serialization.py::test_is_datetime_type bokeh/util/tests/test_serialization.py::test_convert_datetime_type bokeh/util/tests/test_serialization.py::test_traverse_return_valid_json bokeh/util/tests/test_serialization.py::test_traverse_with_numpy bokeh/util/tests/test_serialization.py::test_traverse_without_numpy bokeh/util/tests/test_serialization.py::test_transform_array_force_list_default bokeh/util/tests/test_serialization.py::test_transform_array_force_list_true bokeh/util/tests/test_serialization.py::test_transform_series_force_list_default bokeh/util/tests/test_serialization.py::test_transform_series_force_list_true bokeh/util/tests/test_serialization.py::test_transform_array_to_list bokeh/util/tests/test_serialization.py::test_transform_array_with_nans_to_list[values0] bokeh/util/tests/test_serialization.py::test_transform_array_with_nans_to_list[values1] bokeh/util/tests/test_serialization.py::test_encode_base64_dict bokeh/util/tests/test_serialization.py::test_decode_base64_dict bokeh/util/tests/test_serialization.py::test_encode_decode_roundtrip
bokeh/util/serialization.py
bokeh/util/serialization.py