def datetime2dict(datetimeObj):
    """Return a dictionary keyed by year, month, day, hour, second, millisecond.
    This type of dictionary is used to create javascript Date objects
    """
    if datetimeObj is None:
        return None
    return {
        "year": datetimeObj.year,
        "month": datetimeObj.month,
        "day": datetimeObj.day,
        "hour": datetimeObj.hour,
        "minute": datetimeObj.minute,
        "second": datetimeObj.second,
        "ms": 0,
    }