Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bokeh DatePicker value format inconsistent #8015

martin-centerid opened this issue Jun 20, 2018 · 5 comments


Copy link

commented Jun 20, 2018

I have two DatePicker widgets and I am trying to pass the DatePicker values thru the URL when the user changes the DatePicker value, and I am seeing odd behavior. The DatePicker date format toggles between a string and an epoch when I change the other DatePicker. Best shown by example, here are two URLs that are produced when I change each DatePicker,

Browser: Chrome
Host OS: Windows 10
Python: 2.7.11

from datetime import datetime, timedelta
from bokeh.embed import components
from bokeh.models.widgets.inputs import DatePicker
from bokeh.models.callbacks import CustomJS
from bokeh.layouts import column

from flask import Flask

app = Flask(__name__)

@app.route("/", methods=['GET'])
def test():
    text = """<!DOCTYPE html>
    <html lang="en">
        <link href="" rel="stylesheet" type="text/css">
        <script src=""></script>
        <link href="" rel="stylesheet" type="text/css">
        <script src=""></script>
        <meta charset="UTF-8">

    d_yesterday = - timedelta(days=1)
    d_year_ago = - timedelta(days=365)
    datepicker_start = DatePicker(title="Start Date", min_date=d_year_ago,, value=d_yesterday)
    datepicker_end = DatePicker(title="End Date", min_date=d_year_ago,,

    all_callback = CustomJS(args=dict(d_start=datepicker_start, d_end=datepicker_end), code="""
        function encodeQueryData(data) {
            let ret = [];
            for (let d in data)
                ret.push(encodeURIComponent(d) + '=' + encodeURIComponent(data[d]));
            return ret.join('&');
        var params = {'start_date': d_start.value, 'end_date': d_end.value }
        var url = '/?' + encodeQueryData(params)
    datepicker_start.callback = all_callback
    datepicker_end.callback = all_callback

    layout = column(datepicker_start, datepicker_end)
    _script, _div = components(layout)
    text += "{}{}".format(_script, _div)

    text += """

    return text"", port=6800)

This comment has been minimized.

Copy link

commented Jul 5, 2018

I also noticed that the datepicker can be one day off from what the user selected when using the callback.
And the date sliders also have inconsistent formats, epoch and string.


This comment has been minimized.

Copy link

commented Jul 9, 2018

Note: #8009 appears to be a dupe but verify any solution to this issue solves that as well.


This comment has been minimized.

Copy link

commented Aug 2, 2018

In regards to the off-by-one-day bug, I've noticed that when I set my computer clock to UTC and restart my browser (Firefox) the displayed value in the datepicker is correct when set from the python server.

@bryevdv bryevdv modified the milestones: 0.13.x, short-term Sep 11, 2018


This comment has been minimized.

Copy link

commented Sep 18, 2018

I believe this issue also affects the dat3 range slider, which can return e.g. a date object as well as ms since epoch.


This comment has been minimized.

Copy link

commented Jul 13, 2019

I am fixing this in a PR for #8934

@bryevdv bryevdv referenced this issue Jul 13, 2019
2 of 3 tasks complete

@bryevdv bryevdv modified the milestones: short-term, 1.3 Jul 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.