diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index c4c11511..094dbc6a 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1384,9 +1384,9 @@ ItemSet.prototype._onDrag = function (event) { itemData = this._cloneItemData(itemData); // convert start and end to the correct type me.options.onMoving(itemData, function (itemData) { if (itemData) { - props.item.setData(itemData); + props.item.setData(this._cloneItemData(itemData, 'Date')); } - }); + }.bind(this)); }.bind(this)); this.stackDirty = true; // force re-stacking of all items next redraw @@ -1908,14 +1908,18 @@ ItemSet.itemSetFromTarget = function(event) { * to the type (Date, Moment, ...) configured in the DataSet. If not configured, * start and end are converted to Date. * @param {Object} itemData, typically `item.data` + * @param {string} [type] Optional Date type. If not provided, the type from the DataSet is taken * @return {Object} The cloned object * @private */ -ItemSet.prototype._cloneItemData = function (itemData) { +ItemSet.prototype._cloneItemData = function (itemData, type) { var clone = util.extend({}, itemData); - // convert start and end date to the type (Date, Moment, ...) configured in the DataSet - var type = this.itemsData.getDataSet()._options.type; + if (!type) { + // convert start and end date to the type (Date, Moment, ...) configured in the DataSet + type = this.itemsData.getDataSet()._options.type; + } + if (clone.start != undefined) { clone.start = util.convert(clone.start, type && type.start || 'Date'); }