endOf: function(time, unit) {
return moment(time).endOf(unit).valueOf();
- },
-
- // DEPRECATIONS
-
- /**
- * Provided for backward compatibility with scale.getValueForPixel().
- * @deprecated since version 2.8.0
- * @todo remove at version 3
- * @private
- */
- _create: function(time) {
- return moment(time);
- },
+ }
} : {});
* @param {Unit} unit - the unit as string
* @function
*/
- endOf: abstract,
-
- // DEPRECATIONS
-
- /**
- * Provided for backward compatibility for scale.getValueForPixel(),
- * this method should be overridden only by the moment adapter.
- * @deprecated since version 2.8.0
- * @todo remove at version 3
- * @private
- */
- _create: function(value) {
- return value;
- }
+ endOf: abstract
});
DateAdapter.override = function(members) {
var me = this;
var offsets = me._offsets;
var pos = me.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
- var time = interpolate(me._table, 'pos', pos, 'time');
-
- // DEPRECATION, we should return time directly
- return me._adapter._create(time);
+ return interpolate(me._table, 'pos', pos, 'time');
},
/**
jasmine.addMatchers({
toBeCloseToTime: function() {
return {
- compare: function(actual, expected) {
+ compare: function(time, expected) {
var result = false;
-
+ var actual = moment(time);
var diff = actual.diff(expected.value, expected.unit, true);
result = Math.abs(diff) < (expected.threshold !== undefined ? expected.threshold : 0.01);