|
@ -4,13 +4,8 @@ |
|
|
* |
|
|
* |
|
|
* A dynamic, browser-based visualization library. |
|
|
* A dynamic, browser-based visualization library. |
|
|
* |
|
|
* |
|
|
<<<<<<< HEAD |
|
|
|
|
|
* @version 0.7.4-SNAPSHOT |
|
|
|
|
|
* @date 2014-04-23 |
|
|
|
|
|
======= |
|
|
|
|
|
* @version 0.7.5-SNAPSHOT |
|
|
* @version 0.7.5-SNAPSHOT |
|
|
* @date 2014-04-22 |
|
|
|
|
|
>>>>>>> fc75aed4cec56adbced08aa1804e23797703776f |
|
|
|
|
|
|
|
|
* @date 2014-04-23 |
|
|
* |
|
|
* |
|
|
* @license |
|
|
* @license |
|
|
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
|
|
|
* Copyright (C) 2011-2014 Almende B.V, http://almende.com
|
|
@ -1252,6 +1247,7 @@ util.copyObject = function copyObject(objectFrom, objectTo) { |
|
|
* - gives triggers upon changes in the data |
|
|
* - gives triggers upon changes in the data |
|
|
* - can import/export data in various data formats |
|
|
* - can import/export data in various data formats |
|
|
* |
|
|
* |
|
|
|
|
|
* @param {Array | DataTable} [data] Optional array with initial data |
|
|
* @param {Object} [options] Available options: |
|
|
* @param {Object} [options] Available options: |
|
|
* {String} fieldId Field name of the id in the |
|
|
* {String} fieldId Field name of the id in the |
|
|
* items, 'id' by default. |
|
|
* items, 'id' by default. |
|
@ -1261,9 +1257,15 @@ util.copyObject = function copyObject(objectFrom, objectTo) { |
|
|
* @constructor DataSet |
|
|
* @constructor DataSet |
|
|
*/ |
|
|
*/ |
|
|
// TODO: add a DataSet constructor DataSet(data, options)
|
|
|
// TODO: add a DataSet constructor DataSet(data, options)
|
|
|
function DataSet (options) { |
|
|
|
|
|
|
|
|
function DataSet (data, options) { |
|
|
this.id = util.randomUUID(); |
|
|
this.id = util.randomUUID(); |
|
|
|
|
|
|
|
|
|
|
|
// correctly read optional arguments
|
|
|
|
|
|
if (data && !Array.isArray(data) && !util.isDataTable(data)) { |
|
|
|
|
|
options = data; |
|
|
|
|
|
data = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
this.options = options || {}; |
|
|
this.options = options || {}; |
|
|
this.data = {}; // map with data indexed by id
|
|
|
this.data = {}; // map with data indexed by id
|
|
|
this.fieldId = this.options.fieldId || 'id'; // name of the field containing id
|
|
|
this.fieldId = this.options.fieldId || 'id'; // name of the field containing id
|
|
@ -1284,10 +1286,13 @@ function DataSet (options) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// event subscribers
|
|
|
|
|
|
this.subscribers = {}; |
|
|
|
|
|
|
|
|
this.subscribers = {}; // event subscribers
|
|
|
|
|
|
this.internalIds = {}; // internally generated id's
|
|
|
|
|
|
|
|
|
this.internalIds = {}; // internally generated id's
|
|
|
|
|
|
|
|
|
// add initial data when provided
|
|
|
|
|
|
if (data) { |
|
|
|
|
|
this.add(data); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -3704,7 +3709,7 @@ function Panel(options) { |
|
|
this.options = options || {}; |
|
|
this.options = options || {}; |
|
|
|
|
|
|
|
|
// create frame
|
|
|
// create frame
|
|
|
this.frame = document.createElement('div'); |
|
|
|
|
|
|
|
|
this.frame = (typeof document !== 'undefined') ? document.createElement('div') : null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
Panel.prototype = new Component(); |
|
|
Panel.prototype = new Component(); |
|
@ -5429,8 +5434,8 @@ ItemSet.prototype._onDragEnd = function (event) { |
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
|
|
|
|
|
|
this.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
this.emit('change'); |
|
|
|
|
|
|
|
|
me.stackDirty = true; // force re-stacking of all items next repaint
|
|
|
|
|
|
me.emit('change'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@ -7351,6 +7356,11 @@ Timeline.prototype.setOptions = function (options) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: remove deprecation error one day (deprecated since version 0.8.0)
|
|
|
|
|
|
if (options && options.order) { |
|
|
|
|
|
throw new Error('Option order is deprecated. There is no replacement for this feature.'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// repaint everything
|
|
|
// repaint everything
|
|
|
this.rootPanel.repaint(); |
|
|
this.rootPanel.repaint(); |
|
|
}; |
|
|
}; |
|
@ -7433,10 +7443,23 @@ Timeline.prototype.setItems = function(items) { |
|
|
end = util.convert(this.options.end, 'Date'); |
|
|
end = util.convert(this.options.end, 'Date'); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// apply range if there is a min or max available
|
|
|
|
|
|
if (start != null || end != null) { |
|
|
|
|
|
this.range.setRange(start, end); |
|
|
|
|
|
|
|
|
// skip range set if there is no start and end date
|
|
|
|
|
|
if (start === null && end === null) { |
|
|
|
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// if start and end dates are set but cannot be satisfyed due to zoom restrictions — correct end date
|
|
|
|
|
|
if (start != null && end != null) { |
|
|
|
|
|
var diff = end.valueOf() - start.valueOf(); |
|
|
|
|
|
if (this.options.zoomMax != undefined && this.options.zoomMax < diff) { |
|
|
|
|
|
end = new Date(start.valueOf() + this.options.zoomMax); |
|
|
|
|
|
} |
|
|
|
|
|
if (this.options.zoomMin != undefined && this.options.zoomMin > diff) { |
|
|
|
|
|
end = new Date(start.valueOf() + this.options.zoomMin); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.range.setRange(start, end); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -7565,21 +7588,31 @@ Timeline.prototype.getSelection = function getSelection() { |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Set the visible window. Both parameters are optional, you can change only |
|
|
* Set the visible window. Both parameters are optional, you can change only |
|
|
* start or only end. |
|
|
|
|
|
|
|
|
* start or only end. Syntax: |
|
|
|
|
|
* |
|
|
|
|
|
* TimeLine.setWindow(start, end) |
|
|
|
|
|
* TimeLine.setWindow(range) |
|
|
|
|
|
* |
|
|
|
|
|
* Where start and end can be a Date, number, or string, and range is an |
|
|
|
|
|
* object with properties start and end. |
|
|
|
|
|
* |
|
|
* @param {Date | Number | String} [start] Start date of visible window |
|
|
* @param {Date | Number | String} [start] Start date of visible window |
|
|
* @param {Date | Number | String} [end] End date of visible window |
|
|
* @param {Date | Number | String} [end] End date of visible window |
|
|
*/ |
|
|
*/ |
|
|
// TODO: implement support for setWindow({start: ..., end: ...})
|
|
|
|
|
|
// TODO: rename setWindow to setRange?
|
|
|
|
|
|
Timeline.prototype.setWindow = function setWindow(start, end) { |
|
|
Timeline.prototype.setWindow = function setWindow(start, end) { |
|
|
this.range.setRange(start, end); |
|
|
|
|
|
|
|
|
if (arguments.length == 1) { |
|
|
|
|
|
var range = arguments[0]; |
|
|
|
|
|
this.range.setRange(range.start, range.end); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
this.range.setRange(start, end); |
|
|
|
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Get the visible window |
|
|
* Get the visible window |
|
|
* @return {{start: Date, end: Date}} Visible range |
|
|
* @return {{start: Date, end: Date}} Visible range |
|
|
*/ |
|
|
*/ |
|
|
// TODO: rename getWindow to getRange?
|
|
|
|
|
|
Timeline.prototype.getWindow = function setWindow() { |
|
|
Timeline.prototype.getWindow = function setWindow() { |
|
|
var range = this.range.getRange(); |
|
|
var range = this.range.getRange(); |
|
|
return { |
|
|
return { |
|
@ -19129,8 +19162,8 @@ else { |
|
|
} |
|
|
} |
|
|
})(this); |
|
|
})(this); |
|
|
},{}],4:[function(require,module,exports){ |
|
|
},{}],4:[function(require,module,exports){ |
|
|
var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};//! moment.js
|
|
|
|
|
|
//! version : 2.6.0
|
|
|
|
|
|
|
|
|
//! moment.js
|
|
|
|
|
|
//! version : 2.5.1
|
|
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
|
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
|
|
//! license : MIT
|
|
|
//! license : MIT
|
|
|
//! momentjs.com
|
|
|
//! momentjs.com
|
|
@ -19142,10 +19175,8 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
************************************/ |
|
|
************************************/ |
|
|
|
|
|
|
|
|
var moment, |
|
|
var moment, |
|
|
VERSION = "2.6.0", |
|
|
|
|
|
// the global-scope this is NOT the global object in Node.js
|
|
|
|
|
|
globalScope = typeof global !== 'undefined' ? global : this, |
|
|
|
|
|
oldGlobalMoment, |
|
|
|
|
|
|
|
|
VERSION = "2.5.1", |
|
|
|
|
|
global = this, |
|
|
round = Math.round, |
|
|
round = Math.round, |
|
|
i, |
|
|
i, |
|
|
|
|
|
|
|
@ -19174,7 +19205,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// check for nodeJS
|
|
|
// check for nodeJS
|
|
|
hasModule = (typeof module !== 'undefined' && module.exports), |
|
|
|
|
|
|
|
|
hasModule = (typeof module !== 'undefined' && module.exports && typeof require !== 'undefined'), |
|
|
|
|
|
|
|
|
// ASP.NET json date format regex
|
|
|
// ASP.NET json date format regex
|
|
|
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, |
|
|
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, |
|
@ -19185,7 +19216,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, |
|
|
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, |
|
|
|
|
|
|
|
|
// format tokens
|
|
|
// format tokens
|
|
|
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g, |
|
|
|
|
|
|
|
|
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g, |
|
|
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, |
|
|
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g, |
|
|
|
|
|
|
|
|
// parsing token regexes
|
|
|
// parsing token regexes
|
|
@ -19198,7 +19229,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
|
|
|
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
|
|
|
parseTokenT = /T/i, // T (ISO separator)
|
|
|
parseTokenT = /T/i, // T (ISO separator)
|
|
|
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
|
|
|
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
|
|
|
parseTokenOrdinal = /\d{1,2}/, |
|
|
|
|
|
|
|
|
|
|
|
//strict parsing regexes
|
|
|
//strict parsing regexes
|
|
|
parseTokenOneDigit = /\d/, // 0 - 9
|
|
|
parseTokenOneDigit = /\d/, // 0 - 9
|
|
@ -19224,7 +19254,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
|
|
|
|
|
|
// iso time formats and regexes
|
|
|
// iso time formats and regexes
|
|
|
isoTimes = [ |
|
|
isoTimes = [ |
|
|
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/], |
|
|
|
|
|
|
|
|
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d{1,3}/], |
|
|
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/], |
|
|
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/], |
|
|
['HH:mm', /(T| )\d\d:\d\d/], |
|
|
['HH:mm', /(T| )\d\d:\d\d/], |
|
|
['HH', /(T| )\d\d/] |
|
|
['HH', /(T| )\d\d/] |
|
@ -19255,7 +19285,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
w : 'week', |
|
|
w : 'week', |
|
|
W : 'isoWeek', |
|
|
W : 'isoWeek', |
|
|
M : 'month', |
|
|
M : 'month', |
|
|
Q : 'quarter', |
|
|
|
|
|
y : 'year', |
|
|
y : 'year', |
|
|
DDD : 'dayOfYear', |
|
|
DDD : 'dayOfYear', |
|
|
e : 'weekday', |
|
|
e : 'weekday', |
|
@ -19431,23 +19460,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function deprecate(msg, fn) { |
|
|
|
|
|
var firstTime = true; |
|
|
|
|
|
function printMsg() { |
|
|
|
|
|
if (moment.suppressDeprecationWarnings === false && |
|
|
|
|
|
typeof console !== 'undefined' && console.warn) { |
|
|
|
|
|
console.warn("Deprecation warning: " + msg); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return extend(function () { |
|
|
|
|
|
if (firstTime) { |
|
|
|
|
|
printMsg(); |
|
|
|
|
|
firstTime = false; |
|
|
|
|
|
} |
|
|
|
|
|
return fn.apply(this, arguments); |
|
|
|
|
|
}, fn); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function padToken(func, count) { |
|
|
function padToken(func, count) { |
|
|
return function (a) { |
|
|
return function (a) { |
|
|
return leftZeroFill(func.call(this, a), count); |
|
|
return leftZeroFill(func.call(this, a), count); |
|
@ -19488,7 +19500,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
function Duration(duration) { |
|
|
function Duration(duration) { |
|
|
var normalizedInput = normalizeObjectUnits(duration), |
|
|
var normalizedInput = normalizeObjectUnits(duration), |
|
|
years = normalizedInput.year || 0, |
|
|
years = normalizedInput.year || 0, |
|
|
quarters = normalizedInput.quarter || 0, |
|
|
|
|
|
months = normalizedInput.month || 0, |
|
|
months = normalizedInput.month || 0, |
|
|
weeks = normalizedInput.week || 0, |
|
|
weeks = normalizedInput.week || 0, |
|
|
days = normalizedInput.day || 0, |
|
|
days = normalizedInput.day || 0, |
|
@ -19510,7 +19521,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
// which months you are are talking about, so we have to store
|
|
|
// which months you are are talking about, so we have to store
|
|
|
// it separately.
|
|
|
// it separately.
|
|
|
this._months = +months + |
|
|
this._months = +months + |
|
|
quarters * 3 + |
|
|
|
|
|
years * 12; |
|
|
years * 12; |
|
|
|
|
|
|
|
|
this._data = {}; |
|
|
this._data = {}; |
|
@ -19573,23 +19583,34 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// helper function for _.addTime and _.subtractTime
|
|
|
// helper function for _.addTime and _.subtractTime
|
|
|
function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) { |
|
|
|
|
|
|
|
|
function addOrSubtractDurationFromMoment(mom, duration, isAdding, ignoreUpdateOffset) { |
|
|
var milliseconds = duration._milliseconds, |
|
|
var milliseconds = duration._milliseconds, |
|
|
days = duration._days, |
|
|
days = duration._days, |
|
|
months = duration._months; |
|
|
|
|
|
updateOffset = updateOffset == null ? true : updateOffset; |
|
|
|
|
|
|
|
|
months = duration._months, |
|
|
|
|
|
minutes, |
|
|
|
|
|
hours; |
|
|
|
|
|
|
|
|
if (milliseconds) { |
|
|
if (milliseconds) { |
|
|
mom._d.setTime(+mom._d + milliseconds * isAdding); |
|
|
mom._d.setTime(+mom._d + milliseconds * isAdding); |
|
|
} |
|
|
} |
|
|
|
|
|
// store the minutes and hours so we can restore them
|
|
|
|
|
|
if (days || months) { |
|
|
|
|
|
minutes = mom.minute(); |
|
|
|
|
|
hours = mom.hour(); |
|
|
|
|
|
} |
|
|
if (days) { |
|
|
if (days) { |
|
|
rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding); |
|
|
|
|
|
|
|
|
mom.date(mom.date() + days * isAdding); |
|
|
} |
|
|
} |
|
|
if (months) { |
|
|
if (months) { |
|
|
rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding); |
|
|
|
|
|
|
|
|
mom.month(mom.month() + months * isAdding); |
|
|
|
|
|
} |
|
|
|
|
|
if (milliseconds && !ignoreUpdateOffset) { |
|
|
|
|
|
moment.updateOffset(mom); |
|
|
} |
|
|
} |
|
|
if (updateOffset) { |
|
|
|
|
|
moment.updateOffset(mom, days || months); |
|
|
|
|
|
|
|
|
// restore the minutes and hours after possibly changing dst
|
|
|
|
|
|
if (days || months) { |
|
|
|
|
|
mom.minute(minutes); |
|
|
|
|
|
mom.hour(hours); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -19704,10 +19725,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); |
|
|
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function weeksInYear(year, dow, doy) { |
|
|
|
|
|
return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function daysInYear(year) { |
|
|
function daysInYear(year) { |
|
|
return isLeapYear(year) ? 366 : 365; |
|
|
return isLeapYear(year) ? 366 : 365; |
|
|
} |
|
|
} |
|
@ -20098,8 +20115,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
function getParseRegexForToken(token, config) { |
|
|
function getParseRegexForToken(token, config) { |
|
|
var a, strict = config._strict; |
|
|
var a, strict = config._strict; |
|
|
switch (token) { |
|
|
switch (token) { |
|
|
case 'Q': |
|
|
|
|
|
return parseTokenOneDigit; |
|
|
|
|
|
case 'DDDD': |
|
|
case 'DDDD': |
|
|
return parseTokenThreeDigits; |
|
|
return parseTokenThreeDigits; |
|
|
case 'YYYY': |
|
|
case 'YYYY': |
|
@ -20168,8 +20183,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
case 'e': |
|
|
case 'e': |
|
|
case 'E': |
|
|
case 'E': |
|
|
return parseTokenOneOrTwoDigits; |
|
|
return parseTokenOneOrTwoDigits; |
|
|
case 'Do': |
|
|
|
|
|
return parseTokenOrdinal; |
|
|
|
|
|
default : |
|
|
default : |
|
|
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i")); |
|
|
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), "i")); |
|
|
return a; |
|
|
return a; |
|
@ -20191,12 +20204,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
var a, datePartArray = config._a; |
|
|
var a, datePartArray = config._a; |
|
|
|
|
|
|
|
|
switch (token) { |
|
|
switch (token) { |
|
|
// QUARTER
|
|
|
|
|
|
case 'Q': |
|
|
|
|
|
if (input != null) { |
|
|
|
|
|
datePartArray[MONTH] = (toInt(input) - 1) * 3; |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
// MONTH
|
|
|
// MONTH
|
|
|
case 'M' : // fall through to MM
|
|
|
case 'M' : // fall through to MM
|
|
|
case 'MM' : |
|
|
case 'MM' : |
|
@ -20221,11 +20228,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
datePartArray[DATE] = toInt(input); |
|
|
datePartArray[DATE] = toInt(input); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case 'Do' : |
|
|
|
|
|
if (input != null) { |
|
|
|
|
|
datePartArray[DATE] = toInt(parseInt(input, 10)); |
|
|
|
|
|
} |
|
|
|
|
|
break; |
|
|
|
|
|
// DAY OF YEAR
|
|
|
// DAY OF YEAR
|
|
|
case 'DDD' : // fall through to DDDD
|
|
|
case 'DDD' : // fall through to DDDD
|
|
|
case 'DDDD' : |
|
|
case 'DDDD' : |
|
@ -20236,7 +20238,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
break; |
|
|
break; |
|
|
// YEAR
|
|
|
// YEAR
|
|
|
case 'YY' : |
|
|
case 'YY' : |
|
|
datePartArray[YEAR] = moment.parseTwoDigitYear(input); |
|
|
|
|
|
|
|
|
datePartArray[YEAR] = toInt(input) + (toInt(input) > 68 ? 1900 : 2000); |
|
|
break; |
|
|
break; |
|
|
case 'YYYY' : |
|
|
case 'YYYY' : |
|
|
case 'YYYYY' : |
|
|
case 'YYYYY' : |
|
@ -20325,9 +20327,9 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
//compute day of the year from weeks and weekdays
|
|
|
//compute day of the year from weeks and weekdays
|
|
|
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { |
|
|
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) { |
|
|
fixYear = function (val) { |
|
|
fixYear = function (val) { |
|
|
var intVal = parseInt(val, 10); |
|
|
|
|
|
|
|
|
var int_val = parseInt(val, 10); |
|
|
return val ? |
|
|
return val ? |
|
|
(val.length < 3 ? (intVal > 68 ? 1900 + intVal : 2000 + intVal) : intVal) : |
|
|
|
|
|
|
|
|
(val.length < 3 ? (int_val > 68 ? 1900 + int_val : 2000 + int_val) : int_val) : |
|
|
(config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]); |
|
|
(config._a[YEAR] == null ? moment().weekYear() : config._a[YEAR]); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -20563,7 +20565,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
makeDateFromStringAndFormat(config); |
|
|
makeDateFromStringAndFormat(config); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
moment.createFromInputFallback(config); |
|
|
|
|
|
|
|
|
config._d = new Date(string); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -20584,11 +20586,8 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
config._d = new Date(+input); |
|
|
config._d = new Date(+input); |
|
|
} else if (typeof(input) === 'object') { |
|
|
} else if (typeof(input) === 'object') { |
|
|
dateFromObject(config); |
|
|
dateFromObject(config); |
|
|
} else if (typeof(input) === 'number') { |
|
|
|
|
|
// from milliseconds
|
|
|
|
|
|
config._d = new Date(input); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
moment.createFromInputFallback(config); |
|
|
|
|
|
|
|
|
config._d = new Date(input); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -20715,7 +20714,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
var input = config._i, |
|
|
var input = config._i, |
|
|
format = config._f; |
|
|
format = config._f; |
|
|
|
|
|
|
|
|
if (input === null || (format === undefined && input === '')) { |
|
|
|
|
|
|
|
|
if (input === null) { |
|
|
return moment.invalid({nullInput: true}); |
|
|
return moment.invalid({nullInput: true}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -20761,17 +20760,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return makeMoment(c); |
|
|
return makeMoment(c); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
moment.suppressDeprecationWarnings = false; |
|
|
|
|
|
|
|
|
|
|
|
moment.createFromInputFallback = deprecate( |
|
|
|
|
|
"moment construction falls back to js Date. This is " + |
|
|
|
|
|
"discouraged and will be removed in upcoming major " + |
|
|
|
|
|
"release. Please refer to " + |
|
|
|
|
|
"https://github.com/moment/moment/issues/1407 for more info.", |
|
|
|
|
|
function (config) { |
|
|
|
|
|
config._d = new Date(config._i); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// creating with utc
|
|
|
// creating with utc
|
|
|
moment.utc = function (input, format, lang, strict) { |
|
|
moment.utc = function (input, format, lang, strict) { |
|
|
var c; |
|
|
var c; |
|
@ -20868,10 +20856,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
// default format
|
|
|
// default format
|
|
|
moment.defaultFormat = isoFormat; |
|
|
moment.defaultFormat = isoFormat; |
|
|
|
|
|
|
|
|
// Plugins that add properties should also add the key here (null value),
|
|
|
|
|
|
// so we can properly clone ourselves.
|
|
|
|
|
|
moment.momentProperties = momentProperties; |
|
|
|
|
|
|
|
|
|
|
|
// This function will be called whenever a moment is mutated.
|
|
|
// This function will be called whenever a moment is mutated.
|
|
|
// It is intended to keep the offset in sync with the timezone.
|
|
|
// It is intended to keep the offset in sync with the timezone.
|
|
|
moment.updateOffset = function () {}; |
|
|
moment.updateOffset = function () {}; |
|
@ -20935,12 +20919,8 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return m; |
|
|
return m; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
moment.parseZone = function () { |
|
|
|
|
|
return moment.apply(null, arguments).parseZone(); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
moment.parseTwoDigitYear = function (input) { |
|
|
|
|
|
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); |
|
|
|
|
|
|
|
|
moment.parseZone = function (input) { |
|
|
|
|
|
return moment(input).parseZone(); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/************************************ |
|
|
/************************************ |
|
@ -21127,7 +21107,29 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
month : makeAccessor('Month', true), |
|
|
|
|
|
|
|
|
month : function (input) { |
|
|
|
|
|
var utc = this._isUTC ? 'UTC' : '', |
|
|
|
|
|
dayOfMonth; |
|
|
|
|
|
|
|
|
|
|
|
if (input != null) { |
|
|
|
|
|
if (typeof input === 'string') { |
|
|
|
|
|
input = this.lang().monthsParse(input); |
|
|
|
|
|
if (typeof input !== 'number') { |
|
|
|
|
|
return this; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dayOfMonth = this.date(); |
|
|
|
|
|
this.date(1); |
|
|
|
|
|
this._d['set' + utc + 'Month'](input); |
|
|
|
|
|
this.date(Math.min(dayOfMonth, this.daysInMonth())); |
|
|
|
|
|
|
|
|
|
|
|
moment.updateOffset(this); |
|
|
|
|
|
return this; |
|
|
|
|
|
} else { |
|
|
|
|
|
return this._d['get' + utc + 'Month'](); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
startOf: function (units) { |
|
|
startOf: function (units) { |
|
|
units = normalizeUnits(units); |
|
|
units = normalizeUnits(units); |
|
@ -21137,7 +21139,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
case 'year': |
|
|
case 'year': |
|
|
this.month(0); |
|
|
this.month(0); |
|
|
/* falls through */ |
|
|
/* falls through */ |
|
|
case 'quarter': |
|
|
|
|
|
case 'month': |
|
|
case 'month': |
|
|
this.date(1); |
|
|
this.date(1); |
|
|
/* falls through */ |
|
|
/* falls through */ |
|
@ -21164,11 +21165,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
this.isoWeekday(1); |
|
|
this.isoWeekday(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// quarters are also special
|
|
|
|
|
|
if (units === 'quarter') { |
|
|
|
|
|
this.month(Math.floor(this.month() / 3) * 3); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this; |
|
|
return this; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -21202,17 +21198,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return other > this ? this : other; |
|
|
return other > this ? this : other; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
// keepTime = true means only change the timezone, without affecting
|
|
|
|
|
|
// the local hour. So 5:31:26 +0300 --[zone(2, true)]--> 5:31:26 +0200
|
|
|
|
|
|
// It is possible that 5:31:26 doesn't exist int zone +0200, so we
|
|
|
|
|
|
// adjust the time as needed, to be valid.
|
|
|
|
|
|
//
|
|
|
|
|
|
// Keeping the time actually adds/subtracts (one hour)
|
|
|
|
|
|
// from the actual represented time. That is why we call updateOffset
|
|
|
|
|
|
// a second time. In case it wants us to change the offset again
|
|
|
|
|
|
// _changeInProgress == true case, then we have to adjust, because
|
|
|
|
|
|
// there is no such time in the given timezone.
|
|
|
|
|
|
zone : function (input, keepTime) { |
|
|
|
|
|
|
|
|
zone : function (input) { |
|
|
var offset = this._offset || 0; |
|
|
var offset = this._offset || 0; |
|
|
if (input != null) { |
|
|
if (input != null) { |
|
|
if (typeof input === "string") { |
|
|
if (typeof input === "string") { |
|
@ -21224,14 +21210,7 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
this._offset = input; |
|
|
this._offset = input; |
|
|
this._isUTC = true; |
|
|
this._isUTC = true; |
|
|
if (offset !== input) { |
|
|
if (offset !== input) { |
|
|
if (!keepTime || this._changeInProgress) { |
|
|
|
|
|
addOrSubtractDurationFromMoment(this, |
|
|
|
|
|
moment.duration(offset - input, 'm'), 1, false); |
|
|
|
|
|
} else if (!this._changeInProgress) { |
|
|
|
|
|
this._changeInProgress = true; |
|
|
|
|
|
moment.updateOffset(this, true); |
|
|
|
|
|
this._changeInProgress = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
addOrSubtractDurationFromMoment(this, moment.duration(offset - input, 'm'), 1, true); |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
return this._isUTC ? offset : this._d.getTimezoneOffset(); |
|
|
return this._isUTC ? offset : this._d.getTimezoneOffset(); |
|
@ -21276,8 +21255,8 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return input == null ? dayOfYear : this.add("d", (input - dayOfYear)); |
|
|
return input == null ? dayOfYear : this.add("d", (input - dayOfYear)); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
quarter : function (input) { |
|
|
|
|
|
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); |
|
|
|
|
|
|
|
|
quarter : function () { |
|
|
|
|
|
return Math.ceil((this.month() + 1.0) / 3.0); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
weekYear : function (input) { |
|
|
weekYear : function (input) { |
|
@ -21312,15 +21291,6 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); |
|
|
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7); |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
isoWeeksInYear : function () { |
|
|
|
|
|
return weeksInYear(this.year(), 1, 4); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
weeksInYear : function () { |
|
|
|
|
|
var weekInfo = this._lang._week; |
|
|
|
|
|
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
get : function (units) { |
|
|
get : function (units) { |
|
|
units = normalizeUnits(units); |
|
|
units = normalizeUnits(units); |
|
|
return this[units](); |
|
|
return this[units](); |
|
@ -21347,68 +21317,33 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function rawMonthSetter(mom, value) { |
|
|
|
|
|
var dayOfMonth; |
|
|
|
|
|
|
|
|
|
|
|
// TODO: Move this out of here!
|
|
|
|
|
|
if (typeof value === 'string') { |
|
|
|
|
|
value = mom.lang().monthsParse(value); |
|
|
|
|
|
// TODO: Another silent failure?
|
|
|
|
|
|
if (typeof value !== 'number') { |
|
|
|
|
|
return mom; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dayOfMonth = Math.min(mom.date(), |
|
|
|
|
|
daysInMonth(mom.year(), value)); |
|
|
|
|
|
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); |
|
|
|
|
|
return mom; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function rawGetter(mom, unit) { |
|
|
|
|
|
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit](); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function rawSetter(mom, unit, value) { |
|
|
|
|
|
if (unit === 'Month') { |
|
|
|
|
|
return rawMonthSetter(mom, value); |
|
|
|
|
|
} else { |
|
|
|
|
|
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function makeAccessor(unit, keepTime) { |
|
|
|
|
|
return function (value) { |
|
|
|
|
|
if (value != null) { |
|
|
|
|
|
rawSetter(this, unit, value); |
|
|
|
|
|
moment.updateOffset(this, keepTime); |
|
|
|
|
|
|
|
|
// helper for adding shortcuts
|
|
|
|
|
|
function makeGetterAndSetter(name, key) { |
|
|
|
|
|
moment.fn[name] = moment.fn[name + 's'] = function (input) { |
|
|
|
|
|
var utc = this._isUTC ? 'UTC' : ''; |
|
|
|
|
|
if (input != null) { |
|
|
|
|
|
this._d['set' + utc + key](input); |
|
|
|
|
|
moment.updateOffset(this); |
|
|
return this; |
|
|
return this; |
|
|
} else { |
|
|
} else { |
|
|
return rawGetter(this, unit); |
|
|
|
|
|
|
|
|
return this._d['get' + utc + key](); |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false); |
|
|
|
|
|
moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false); |
|
|
|
|
|
moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false); |
|
|
|
|
|
// Setting the hour should keep the time, because the user explicitly
|
|
|
|
|
|
// specified which hour he wants. So trying to maintain the same hour (in
|
|
|
|
|
|
// a new timezone) makes sense. Adding/subtracting hours does not follow
|
|
|
|
|
|
// this rule.
|
|
|
|
|
|
moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true); |
|
|
|
|
|
// moment.fn.month is defined separately
|
|
|
|
|
|
moment.fn.date = makeAccessor('Date', true); |
|
|
|
|
|
moment.fn.dates = deprecate("dates accessor is deprecated. Use date instead.", makeAccessor('Date', true)); |
|
|
|
|
|
moment.fn.year = makeAccessor('FullYear', true); |
|
|
|
|
|
moment.fn.years = deprecate("years accessor is deprecated. Use year instead.", makeAccessor('FullYear', true)); |
|
|
|
|
|
|
|
|
// loop through and add shortcuts (Month, Date, Hours, Minutes, Seconds, Milliseconds)
|
|
|
|
|
|
for (i = 0; i < proxyGettersAndSetters.length; i ++) { |
|
|
|
|
|
makeGetterAndSetter(proxyGettersAndSetters[i].toLowerCase().replace(/s$/, ''), proxyGettersAndSetters[i]); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// add shortcut for year (uses different syntax than the getter/setter 'year' == 'FullYear')
|
|
|
|
|
|
makeGetterAndSetter('year', 'FullYear'); |
|
|
|
|
|
|
|
|
// add plural methods
|
|
|
// add plural methods
|
|
|
moment.fn.days = moment.fn.day; |
|
|
moment.fn.days = moment.fn.day; |
|
|
moment.fn.months = moment.fn.month; |
|
|
moment.fn.months = moment.fn.month; |
|
|
moment.fn.weeks = moment.fn.week; |
|
|
moment.fn.weeks = moment.fn.week; |
|
|
moment.fn.isoWeeks = moment.fn.isoWeek; |
|
|
moment.fn.isoWeeks = moment.fn.isoWeek; |
|
|
moment.fn.quarters = moment.fn.quarter; |
|
|
|
|
|
|
|
|
|
|
|
// add aliased format methods
|
|
|
// add aliased format methods
|
|
|
moment.fn.toJSON = moment.fn.toISOString; |
|
|
moment.fn.toJSON = moment.fn.toISOString; |
|
@ -21584,36 +21519,45 @@ var global=typeof self !== "undefined" ? self : typeof window !== "undefined" ? |
|
|
Exposing Moment |
|
|
Exposing Moment |
|
|
************************************/ |
|
|
************************************/ |
|
|
|
|
|
|
|
|
function makeGlobal(shouldDeprecate) { |
|
|
|
|
|
|
|
|
function makeGlobal(deprecate) { |
|
|
|
|
|
var warned = false, local_moment = moment; |
|
|
/*global ender:false */ |
|
|
/*global ender:false */ |
|
|
if (typeof ender !== 'undefined') { |
|
|
if (typeof ender !== 'undefined') { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
oldGlobalMoment = globalScope.moment; |
|
|
|
|
|
if (shouldDeprecate) { |
|
|
|
|
|
globalScope.moment = deprecate( |
|
|
|
|
|
"Accessing Moment through the global scope is " + |
|
|
|
|
|
"deprecated, and will be removed in an upcoming " + |
|
|
|
|
|
"release.", |
|
|
|
|
|
moment); |
|
|
|
|
|
|
|
|
// here, `this` means `window` in the browser, or `global` on the server
|
|
|
|
|
|
// add `moment` as a global object via a string identifier,
|
|
|
|
|
|
// for Closure Compiler "advanced" mode
|
|
|
|
|
|
if (deprecate) { |
|
|
|
|
|
global.moment = function () { |
|
|
|
|
|
if (!warned && console && console.warn) { |
|
|
|
|
|
warned = true; |
|
|
|
|
|
console.warn( |
|
|
|
|
|
"Accessing Moment through the global scope is " + |
|
|
|
|
|
"deprecated, and will be removed in an upcoming " + |
|
|
|
|
|
"release."); |
|
|
|
|
|
} |
|
|
|
|
|
return local_moment.apply(null, arguments); |
|
|
|
|
|
}; |
|
|
|
|
|
extend(global.moment, local_moment); |
|
|
} else { |
|
|
} else { |
|
|
globalScope.moment = moment; |
|
|
|
|
|
|
|
|
global['moment'] = moment; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// CommonJS module is defined
|
|
|
// CommonJS module is defined
|
|
|
if (hasModule) { |
|
|
if (hasModule) { |
|
|
module.exports = moment; |
|
|
module.exports = moment; |
|
|
|
|
|
makeGlobal(true); |
|
|
} else if (typeof define === "function" && define.amd) { |
|
|
} else if (typeof define === "function" && define.amd) { |
|
|
define("moment", function (require, exports, module) { |
|
|
define("moment", function (require, exports, module) { |
|
|
if (module.config && module.config() && module.config().noGlobal === true) { |
|
|
|
|
|
// release the global variable
|
|
|
|
|
|
globalScope.moment = oldGlobalMoment; |
|
|
|
|
|
|
|
|
if (module.config && module.config() && module.config().noGlobal !== true) { |
|
|
|
|
|
// If user provided noGlobal, he is aware of global
|
|
|
|
|
|
makeGlobal(module.config().noGlobal === undefined); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return moment; |
|
|
return moment; |
|
|
}); |
|
|
}); |
|
|
makeGlobal(true); |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
makeGlobal(); |
|
|
makeGlobal(); |
|
|
} |
|
|
} |
|
|