bulma-extensions
Version:
Set of extensions for Bulma.io CSS Framework
20,022 lines • 571 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["bulmaExtensions"] = factory();
else
root["bulmaExtensions"] = factory();
})(typeof self !== 'undefined' ? self : this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 196);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
var isDate = __webpack_require__(115)
var MILLISECONDS_IN_HOUR = 3600000
var MILLISECONDS_IN_MINUTE = 60000
var DEFAULT_ADDITIONAL_DIGITS = 2
var parseTokenDateTimeDelimeter = /[T ]/
var parseTokenPlainTime = /:/
// year tokens
var parseTokenYY = /^(\d{2})$/
var parseTokensYYY = [
/^([+-]\d{2})$/, // 0 additional digits
/^([+-]\d{3})$/, // 1 additional digit
/^([+-]\d{4})$/ // 2 additional digits
]
var parseTokenYYYY = /^(\d{4})/
var parseTokensYYYYY = [
/^([+-]\d{4})/, // 0 additional digits
/^([+-]\d{5})/, // 1 additional digit
/^([+-]\d{6})/ // 2 additional digits
]
// date tokens
var parseTokenMM = /^-(\d{2})$/
var parseTokenDDD = /^-?(\d{3})$/
var parseTokenMMDD = /^-?(\d{2})-?(\d{2})$/
var parseTokenWww = /^-?W(\d{2})$/
var parseTokenWwwD = /^-?W(\d{2})-?(\d{1})$/
// time tokens
var parseTokenHH = /^(\d{2}([.,]\d*)?)$/
var parseTokenHHMM = /^(\d{2}):?(\d{2}([.,]\d*)?)$/
var parseTokenHHMMSS = /^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/
// timezone tokens
var parseTokenTimezone = /([Z+-].*)$/
var parseTokenTimezoneZ = /^(Z)$/
var parseTokenTimezoneHH = /^([+-])(\d{2})$/
var parseTokenTimezoneHHMM = /^([+-])(\d{2}):?(\d{2})$/
/**
* @category Common Helpers
* @summary Convert the given argument to an instance of Date.
*
* @description
* Convert the given argument to an instance of Date.
*
* If the argument is an instance of Date, the function returns its clone.
*
* If the argument is a number, it is treated as a timestamp.
*
* If an argument is a string, the function tries to parse it.
* Function accepts complete ISO 8601 formats as well as partial implementations.
* ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
*
* If all above fails, the function passes the given argument to Date constructor.
*
* @param {Date|String|Number} argument - the value to convert
* @param {Object} [options] - the object with options
* @param {0 | 1 | 2} [options.additionalDigits=2] - the additional number of digits in the extended year format
* @returns {Date} the parsed date in the local time zone
*
* @example
* // Convert string '2014-02-11T11:30:30' to date:
* var result = parse('2014-02-11T11:30:30')
* //=> Tue Feb 11 2014 11:30:30
*
* @example
* // Parse string '+02014101',
* // if the additional number of digits in the extended year format is 1:
* var result = parse('+02014101', {additionalDigits: 1})
* //=> Fri Apr 11 2014 00:00:00
*/
function parse (argument, dirtyOptions) {
if (isDate(argument)) {
// Prevent the date to lose the milliseconds when passed to new Date() in IE10
return new Date(argument.getTime())
} else if (typeof argument !== 'string') {
return new Date(argument)
}
var options = dirtyOptions || {}
var additionalDigits = options.additionalDigits
if (additionalDigits == null) {
additionalDigits = DEFAULT_ADDITIONAL_DIGITS
} else {
additionalDigits = Number(additionalDigits)
}
var dateStrings = splitDateString(argument)
var parseYearResult = parseYear(dateStrings.date, additionalDigits)
var year = parseYearResult.year
var restDateString = parseYearResult.restDateString
var date = parseDate(restDateString, year)
if (date) {
var timestamp = date.getTime()
var time = 0
var offset
if (dateStrings.time) {
time = parseTime(dateStrings.time)
}
if (dateStrings.timezone) {
offset = parseTimezone(dateStrings.timezone)
} else {
// get offset accurate to hour in timezones that change offset
offset = new Date(timestamp + time).getTimezoneOffset()
offset = new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE).getTimezoneOffset()
}
return new Date(timestamp + time + offset * MILLISECONDS_IN_MINUTE)
} else {
return new Date(argument)
}
}
function splitDateString (dateString) {
var dateStrings = {}
var array = dateString.split(parseTokenDateTimeDelimeter)
var timeString
if (parseTokenPlainTime.test(array[0])) {
dateStrings.date = null
timeString = array[0]
} else {
dateStrings.date = array[0]
timeString = array[1]
}
if (timeString) {
var token = parseTokenTimezone.exec(timeString)
if (token) {
dateStrings.time = timeString.replace(token[1], '')
dateStrings.timezone = token[1]
} else {
dateStrings.time = timeString
}
}
return dateStrings
}
function parseYear (dateString, additionalDigits) {
var parseTokenYYY = parseTokensYYY[additionalDigits]
var parseTokenYYYYY = parseTokensYYYYY[additionalDigits]
var token
// YYYY or ±YYYYY
token = parseTokenYYYY.exec(dateString) || parseTokenYYYYY.exec(dateString)
if (token) {
var yearString = token[1]
return {
year: parseInt(yearString, 10),
restDateString: dateString.slice(yearString.length)
}
}
// YY or ±YYY
token = parseTokenYY.exec(dateString) || parseTokenYYY.exec(dateString)
if (token) {
var centuryString = token[1]
return {
year: parseInt(centuryString, 10) * 100,
restDateString: dateString.slice(centuryString.length)
}
}
// Invalid ISO-formatted year
return {
year: null
}
}
function parseDate (dateString, year) {
// Invalid ISO-formatted year
if (year === null) {
return null
}
var token
var date
var month
var week
// YYYY
if (dateString.length === 0) {
date = new Date(0)
date.setUTCFullYear(year)
return date
}
// YYYY-MM
token = parseTokenMM.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
date.setUTCFullYear(year, month)
return date
}
// YYYY-DDD or YYYYDDD
token = parseTokenDDD.exec(dateString)
if (token) {
date = new Date(0)
var dayOfYear = parseInt(token[1], 10)
date.setUTCFullYear(year, 0, dayOfYear)
return date
}
// YYYY-MM-DD or YYYYMMDD
token = parseTokenMMDD.exec(dateString)
if (token) {
date = new Date(0)
month = parseInt(token[1], 10) - 1
var day = parseInt(token[2], 10)
date.setUTCFullYear(year, month, day)
return date
}
// YYYY-Www or YYYYWww
token = parseTokenWww.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
return dayOfISOYear(year, week)
}
// YYYY-Www-D or YYYYWwwD
token = parseTokenWwwD.exec(dateString)
if (token) {
week = parseInt(token[1], 10) - 1
var dayOfWeek = parseInt(token[2], 10) - 1
return dayOfISOYear(year, week, dayOfWeek)
}
// Invalid ISO-formatted date
return null
}
function parseTime (timeString) {
var token
var hours
var minutes
// hh
token = parseTokenHH.exec(timeString)
if (token) {
hours = parseFloat(token[1].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR
}
// hh:mm or hhmm
token = parseTokenHHMM.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseFloat(token[2].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE
}
// hh:mm:ss or hhmmss
token = parseTokenHHMMSS.exec(timeString)
if (token) {
hours = parseInt(token[1], 10)
minutes = parseInt(token[2], 10)
var seconds = parseFloat(token[3].replace(',', '.'))
return (hours % 24) * MILLISECONDS_IN_HOUR +
minutes * MILLISECONDS_IN_MINUTE +
seconds * 1000
}
// Invalid ISO-formatted time
return null
}
function parseTimezone (timezoneString) {
var token
var absoluteOffset
// Z
token = parseTokenTimezoneZ.exec(timezoneString)
if (token) {
return 0
}
// ±hh
token = parseTokenTimezoneHH.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
// ±hh:mm or ±hhmm
token = parseTokenTimezoneHHMM.exec(timezoneString)
if (token) {
absoluteOffset = parseInt(token[2], 10) * 60 + parseInt(token[3], 10)
return (token[1] === '+') ? -absoluteOffset : absoluteOffset
}
return 0
}
function dayOfISOYear (isoYear, week, day) {
week = week || 0
day = day || 0
var date = new Date(0)
date.setUTCFullYear(isoYear, 0, 4)
var fourthOfJanuaryDay = date.getUTCDay() || 7
var diff = week * 7 + day + 1 - fourthOfJanuaryDay
date.setUTCDate(date.getUTCDate() + diff)
return date
}
module.exports = parse
/***/ }),
/* 1 */
/***/ (function(module, exports) {
var commonFormatterKeys = [
'M', 'MM', 'Q', 'D', 'DD', 'DDD', 'DDDD', 'd',
'E', 'W', 'WW', 'YY', 'YYYY', 'GG', 'GGGG',
'H', 'HH', 'h', 'hh', 'm', 'mm',
's', 'ss', 'S', 'SS', 'SSS',
'Z', 'ZZ', 'X', 'x'
]
function buildFormattingTokensRegExp (formatters) {
var formatterKeys = []
for (var key in formatters) {
if (formatters.hasOwnProperty(key)) {
formatterKeys.push(key)
}
}
var formattingTokens = commonFormatterKeys
.concat(formatterKeys)
.sort()
.reverse()
var formattingTokensRegExp = new RegExp(
'(\\[[^\\[]*\\])|(\\\\)?' + '(' + formattingTokens.join('|') + '|.)', 'g'
)
return formattingTokensRegExp
}
module.exports = buildFormattingTokensRegExp
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var startOfISOWeek = __webpack_require__(3)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Get the ISO week-numbering year of the given date.
*
* @description
* Get the ISO week-numbering year of the given date,
* which always starts 3 days before the year's first Thursday.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the ISO week-numbering year
*
* @example
* // Which ISO-week numbering year is 2 January 2005?
* var result = getISOYear(new Date(2005, 0, 2))
* //=> 2004
*/
function getISOYear (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
var fourthOfJanuaryOfNextYear = new Date(0)
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4)
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0)
var startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear)
var fourthOfJanuaryOfThisYear = new Date(0)
fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4)
fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0)
var startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear)
if (date.getTime() >= startOfNextYear.getTime()) {
return year + 1
} else if (date.getTime() >= startOfThisYear.getTime()) {
return year
} else {
return year - 1
}
}
module.exports = getISOYear
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var startOfWeek = __webpack_require__(78)
/**
* @category ISO Week Helpers
* @summary Return the start of an ISO week for the given date.
*
* @description
* Return the start of an ISO week for the given date.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of an ISO week
*
* @example
* // The start of an ISO week for 2 September 2014 11:55:00:
* var result = startOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfISOWeek (dirtyDate) {
return startOfWeek(dirtyDate, {weekStartsOn: 1})
}
module.exports = startOfISOWeek
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Return the start of a day for the given date.
*
* @description
* Return the start of a day for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a day
*
* @example
* // The start of a day for 2 September 2014 11:55:00:
* var result = startOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 00:00:00
*/
function startOfDay (dirtyDate) {
var date = parse(dirtyDate)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfDay
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(10)
var buildFormatLocale = __webpack_require__(11)
/**
* @category Locales
* @summary English locale.
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Add the specified number of days to the given date.
*
* @description
* Add the specified number of days to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be added
* @returns {Date} the new date with the days added
*
* @example
* // Add 10 days to 1 September 2014:
* var result = addDays(new Date(2014, 8, 1), 10)
* //=> Thu Sep 11 2014 00:00:00
*/
function addDays (dirtyDate, dirtyAmount) {
var date = parse(dirtyDate)
var amount = Number(dirtyAmount)
date.setDate(date.getDate() + amount)
return date
}
module.exports = addDays
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Millisecond Helpers
* @summary Add the specified number of milliseconds to the given date.
*
* @description
* Add the specified number of milliseconds to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be added
* @returns {Date} the new date with the milliseconds added
*
* @example
* // Add 750 milliseconds to 10 July 2014 12:45:30.000:
* var result = addMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
* //=> Thu Jul 10 2014 12:45:30.750
*/
function addMilliseconds (dirtyDate, dirtyAmount) {
var timestamp = parse(dirtyDate).getTime()
var amount = Number(dirtyAmount)
return new Date(timestamp + amount)
}
module.exports = addMilliseconds
/***/ }),
/* 8 */
/***/ (function(module, exports, __webpack_require__) {
var getISOYear = __webpack_require__(2)
var startOfISOWeek = __webpack_require__(3)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Return the start of an ISO week-numbering year for the given date.
*
* @description
* Return the start of an ISO week-numbering year,
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of an ISO year
*
* @example
* // The start of an ISO week-numbering year for 2 July 2005:
* var result = startOfISOYear(new Date(2005, 6, 2))
* //=> Mon Jan 03 2005 00:00:00
*/
function startOfISOYear (dirtyDate) {
var year = getISOYear(dirtyDate)
var fourthOfJanuary = new Date(0)
fourthOfJanuary.setFullYear(year, 0, 4)
fourthOfJanuary.setHours(0, 0, 0, 0)
var date = startOfISOWeek(fourthOfJanuary)
return date
}
module.exports = startOfISOYear
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Compare the two dates and return -1, 0 or 1.
*
* @description
* Compare the two dates and return 1 if the first date is after the second,
* -1 if the first date is before the second or 0 if dates are equal.
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Number} the result of the comparison
*
* @example
* // Compare 11 February 1987 and 10 July 1989:
* var result = compareAsc(
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* )
* //=> -1
*
* @example
* // Sort the array of dates:
* var result = [
* new Date(1995, 6, 2),
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* ].sort(compareAsc)
* //=> [
* // Wed Feb 11 1987 00:00:00,
* // Mon Jul 10 1989 00:00:00,
* // Sun Jul 02 1995 00:00:00
* // ]
*/
function compareAsc (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var timeLeft = dateLeft.getTime()
var dateRight = parse(dirtyDateRight)
var timeRight = dateRight.getTime()
if (timeLeft < timeRight) {
return -1
} else if (timeLeft > timeRight) {
return 1
} else {
return 0
}
}
module.exports = compareAsc
/***/ }),
/* 10 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'less than a second',
other: 'less than {{count}} seconds'
},
xSeconds: {
one: '1 second',
other: '{{count}} seconds'
},
halfAMinute: 'half a minute',
lessThanXMinutes: {
one: 'less than a minute',
other: 'less than {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'about 1 hour',
other: 'about {{count}} hours'
},
xHours: {
one: '1 hour',
other: '{{count}} hours'
},
xDays: {
one: '1 day',
other: '{{count}} days'
},
aboutXMonths: {
one: 'about 1 month',
other: 'about {{count}} months'
},
xMonths: {
one: '1 month',
other: '{{count}} months'
},
aboutXYears: {
one: 'about 1 year',
other: 'about {{count}} years'
},
xYears: {
one: '1 year',
other: '{{count}} years'
},
overXYears: {
one: 'over 1 year',
other: 'over {{count}} years'
},
almostXYears: {
one: 'almost 1 year',
other: 'almost {{count}} years'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'in ' + result
} else {
return result + ' ago'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
var monthsFull = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
var weekdays2char = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
var weekdays3char = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
var weekdaysFull = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + 'st'
case 2:
return number + 'nd'
case 3:
return number + 'rd'
}
}
return number + 'th'
}
module.exports = buildFormatLocale
/***/ }),
/* 12 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'أقل من ثانية واحدة',
other: 'أقل من {{count}} ثواني'
},
xSeconds: {
one: 'ثانية واحدة',
other: '{{count}} ثواني'
},
halfAMinute: 'نصف دقيقة',
lessThanXMinutes: {
one: 'أقل من دقيقة',
other: 'أقل من {{count}} دقيقة'
},
xMinutes: {
one: 'دقيقة واحدة',
other: '{{count}} دقائق'
},
aboutXHours: {
one: 'ساعة واحدة تقريباً',
other: '{{count}} ساعات تقريباً'
},
xHours: {
one: 'ساعة واحدة',
other: '{{count}} ساعات'
},
xDays: {
one: 'يوم واحد',
other: '{{count}} أيام'
},
aboutXMonths: {
one: 'شهر واحد تقريباً',
other: '{{count}} أشهر تقريباً'
},
xMonths: {
one: 'شهر واحد',
other: '{{count}} أشهر'
},
aboutXYears: {
one: 'عام واحد تقريباً',
other: '{{count}} أعوام تقريباً'
},
xYears: {
one: 'عام واحد',
other: '{{count}} أعوام'
},
overXYears: {
one: 'أكثر من عام',
other: 'أكثر من {{count}} أعوام'
},
almostXYears: {
one: 'عام واحد تقريباً',
other: '{{count}} أعوام تقريباً'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'في خلال ' + result
} else {
return 'منذ ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['يناير', 'فبراير', 'مارس', 'أبريل', 'مايو', 'يونيو', 'يوليو', 'أغسطس', 'سبتمبر', 'أكتوبر', 'نوفمبر', 'ديسمبر']
var monthsFull = ['كانون الثاني يناير', 'شباط فبراير', 'آذار مارس', 'نيسان أبريل', 'أيار مايو', 'حزيران يونيو', 'تموز يوليو', 'آب أغسطس', 'أيلول سبتمبر', 'تشرين الأول أكتوبر', 'تشرين الثاني نوفمبر', 'كانون الأول ديسمبر']
var weekdays2char = ['ح', 'ن', 'ث', 'ر', 'خ', 'ج', 'س']
var weekdays3char = ['أحد', 'إثنين', 'ثلاثاء', 'أربعاء', 'خميس', 'جمعة', 'سبت']
var weekdaysFull = ['الأحد', 'الإثنين', 'الثلاثاء', 'الأربعاء', 'الخميس', 'الجمعة', 'السبت']
var meridiemUppercase = ['صباح', 'مساء']
var meridiemLowercase = ['ص', 'م']
var meridiemFull = ['صباحاً', 'مساءاً']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return String(number)
}
module.exports = buildFormatLocale
/***/ }),
/* 14 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'по-малко от секунда',
other: 'по-малко от {{count}} секунди'
},
xSeconds: {
one: '1 секунда',
other: '{{count}} секунди'
},
halfAMinute: 'половин минута',
lessThanXMinutes: {
one: 'по-малко от минута',
other: 'по-малко от {{count}} минути'
},
xMinutes: {
one: '1 минута',
other: '{{count}} минути'
},
aboutXHours: {
one: 'около час',
other: 'около {{count}} часа'
},
xHours: {
one: '1 час',
other: '{{count}} часа'
},
xDays: {
one: '1 ден',
other: '{{count}} дни'
},
aboutXMonths: {
one: 'около месец',
other: 'около {{count}} месеца'
},
xMonths: {
one: '1 месец',
other: '{{count}} месеца'
},
aboutXYears: {
one: 'около година',
other: 'около {{count}} години'
},
xYears: {
one: '1 година',
other: '{{count}} години'
},
overXYears: {
one: 'над година',
other: 'над {{count}} години'
},
almostXYears: {
one: 'почти година',
other: 'почти {{count}} години'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'след ' + result
} else {
return 'преди ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['яну', 'фев', 'мар', 'апр', 'май', 'юни', 'юли', 'авг', 'сеп', 'окт', 'ное', 'дек']
var monthsFull = ['януари', 'февруари', 'март', 'април', 'май', 'юни', 'юли', 'август', 'септември', 'октомври', 'ноември', 'декември']
var weekdays2char = ['нд', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб']
var weekdays3char = ['нед', 'пон', 'вто', 'сря', 'чет', 'пет', 'съб']
var weekdaysFull = ['неделя', 'понеделник', 'вторник', 'сряда', 'четвъртък', 'петък', 'събота']
var meridiem = ['сутринта', 'на обяд', 'следобед', 'вечерта']
var timeOfDay = function (date) {
var hours = date.getHours()
if (hours >= 4 && hours < 12) {
return meridiem[0]
} else if (hours >= 12 && hours < 14) {
return meridiem[1]
} else if (hours >= 14 && hours < 17) {
return meridiem[2]
} else {
return meridiem[3]
}
}
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': timeOfDay,
// am, pm
'a': timeOfDay,
// a.m., p.m.
'aa': timeOfDay
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + '-ви'
case 2:
return number + '-ри'
}
}
return number + '-и'
}
module.exports = buildFormatLocale
/***/ }),
/* 16 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: "menys d'un segon",
other: 'menys de {{count}} segons'
},
xSeconds: {
one: '1 segon',
other: '{{count}} segons'
},
halfAMinute: 'mig minut',
lessThanXMinutes: {
one: "menys d'un minut",
other: 'menys de {{count}} minuts'
},
xMinutes: {
one: '1 minut',
other: '{{count}} minuts'
},
aboutXHours: {
one: 'aproximadament una hora',
other: 'aproximadament {{count}} hores'
},
xHours: {
one: '1 hora',
other: '{{count}} hores'
},
xDays: {
one: '1 dia',
other: '{{count}} dies'
},
aboutXMonths: {
one: 'aproximadament un mes',
other: 'aproximadament {{count}} mesos'
},
xMonths: {
one: '1 mes',
other: '{{count}} mesos'
},
aboutXYears: {
one: 'aproximadament un any',
other: 'aproximadament {{count}} anys'
},
xYears: {
one: '1 any',
other: '{{count}} anys'
},
overXYears: {
one: "més d'un any",
other: 'més de {{count}} anys'
},
almostXYears: {
one: 'gairebé un any',
other: 'gairebé {{count}} anys'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'en ' + result
} else {
return 'fa ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['gen', 'feb', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'oct', 'nov', 'des']
var monthsFull = ['gener', 'febrer', 'març', 'abril', 'maig', 'juny', 'juliol', 'agost', 'setembre', 'octobre', 'novembre', 'desembre']
var weekdays2char = ['dg', 'dl', 'dt', 'dc', 'dj', 'dv', 'ds']
var weekdays3char = ['dge', 'dls', 'dts', 'dcs', 'djs', 'dvs', 'dss']
var weekdaysFull = ['diumenge', 'dilluns', 'dimarts', 'dimecres', 'dijous', 'divendres', 'dissabte']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
switch (number) {
case 1:
return '1r'
case 2:
return '2n'
case 3:
return '3r'
case 4:
return '4t'
default:
return number + 'è'
}
}
module.exports = buildFormatLocale
/***/ }),
/* 18 */
/***/ (function(module, exports) {
function declensionGroup (scheme, count) {
if (count === 1) {
return scheme.one
}
if (count >= 2 && count <= 4) {
return scheme.twoFour
}
// if count === null || count === 0 || count >= 5
return scheme.other
}
function declension (scheme, count, time) {
var group = declensionGroup(scheme, count)
var finalText = group[time] || group
return finalText.replace('{{count}}', count)
}
function extractPreposition (token) {
var result = ['lessThan', 'about', 'over', 'almost'].filter(function (preposition) {
return !!token.match(new RegExp('^' + preposition))
})
return result[0]
}
function prefixPreposition (preposition) {
var translation = ''
if (preposition === 'almost') {
translation = 'skoro'
}
if (preposition === 'about') {
translation = 'přibližně'
}
return translation.length > 0 ? translation + ' ' : ''
}
function suffixPreposition (preposition) {
var translation = ''
if (preposition === 'lessThan') {
translation = 'méně než'
}
if (preposition === 'over') {
translation = 'více než'
}
return translation.length > 0 ? translation + ' ' : ''
}
function lowercaseFirstLetter (string) {
return string.charAt(0).toLowerCase() + string.slice(1)
}
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
xSeconds: {
one: {
regular: 'vteřina',
past: 'vteřinou',
future: 'vteřinu'
},
twoFour: {
regular: '{{count}} vteřiny',
past: '{{count}} vteřinami',
future: '{{count}} vteřiny'
},
other: {
regular: '{{count}} vteřin',
past: '{{count}} vteřinami',
future: '{{count}} vteřin'
}
},
halfAMinute: {
other: {
regular: 'půl minuty',
past: 'půl minutou',
future: 'půl minuty'
}
},
xMinutes: {
one: {
regular: 'minuta',
past: 'minutou',
future: 'minutu'
},
twoFour: {
regular: '{{count}} minuty',
past: '{{count}} minutami',
future: '{{count}} minuty'
},
other: {
regular: '{{count}} minut',
past: '{{count}} minutami',
future: '{{count}} minut'
}
},
xHours: {
one: {
regular: 'hodina',
past: 'hodinou',
future: 'hodinu'
},
twoFour: {
regular: '{{count}} hodiny',
past: '{{count}} hodinami',
future: '{{count}} hodiny'
},
other: {
regular: '{{count}} hodin',
past: '{{count}} hodinami',
future: '{{count}} hodin'
}
},
xDays: {
one: {
regular: 'den',
past: 'dnem',
future: 'den'
},
twoFour: {
regular: '{{count}} dni',
past: '{{count}} dny',
future: '{{count}} dni'
},
other: {
regular: '{{count}} dní',
past: '{{count}} dny',
future: '{{count}} dní'
}
},
xMonths: {
one: {
regular: 'měsíc',
past: 'měsícem',
future: 'měsíc'
},
twoFour: {
regular: '{{count}} měsíce',
past: '{{count}} měsíci',
future: '{{count}} měsíce'
},
other: {
regular: '{{count}} měsíců',
past: '{{count}} měsíci',
future: '{{count}} měsíců'
}
},
xYears: {
one: {
regular: 'rok',
past: 'rokem',
future: 'rok'
},
twoFour: {
regular: '{{count}} roky',
past: '{{count}} roky',
future: '{{count}} roky'
},
other: {
regular: '{{count}} roků',
past: '{{count}} roky',
future: '{{count}} roků'
}
}
}
function localize (token, count, options) {
options = options || {}
var preposition = extractPreposition(token) || ''
var key = lowercaseFirstLetter(token.substring(preposition.length))
var scheme = distanceInWordsLocale[key]
if (!options.addSuffix) {
return prefixPreposition(preposition) + suffixPreposition(preposition) + declension(scheme, count, 'regular')
}
if (options.comparison > 0) {
return prefixPreposition(preposition) + 'za ' + suffixPreposition(preposition) + declension(scheme, count, 'future')
} else {
return prefixPreposition(preposition) + 'před ' + suffixPreposition(preposition) + declension(scheme, count, 'past')
}
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['led', 'úno', 'bře', 'dub', 'kvě', 'čvn', 'čvc', 'srp', 'zář', 'říj', 'lis', 'pro']
var monthsFull = ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec']
var weekdays2char = ['ne', 'po', 'út', 'st', 'čt', 'pá', 'so']
var weekdays3char = ['ned', 'pon', 'úte', 'stř', 'čtv', 'pát', 'sob']
var weekdaysFull = ['neděle', 'pondělí', 'úterý', 'středa', 'čtvrtek', 'pátek', 'sobota']
var meridiemUppercase = ['DOP.', 'ODP.']
var meridiemLowercase = ['dop.', 'odp.']
var meridiemFull = ['dopoledne', 'odpoledne']
var formatters = {
// Month: led, úno, ..., pro
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: leden, únor, ..., prosinec
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: ne, po, ..., so
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: ned, pon, ..., sob
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: neděle, pondělí, ..., sobota
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// DOP., ODP.
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// dop., odp.
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// dopoledne, odpoledne
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 20 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'mindre end et sekund',
other: 'mindre end {{count}} sekunder'
},
xSeconds: {
one: '1 sekund',
other: '{{count}} sekunder'
},
halfAMinute: 'et halvt minut',
lessThanXMinutes: {
one: 'mindre end et minut',
other: 'mindre end {{count}} minutter'
},
xMinutes: {
one: '1 minut',
other: '{{count}} minutter'
},
aboutXHours: {
one: 'cirka 1 time',
other: 'cirka {{count}} timer'
},
xHours: {
one: '1 time',
other: '{{count}} timer'
},
xDays: {
one: '1 dag',
other: '{{count}} dage'
},
aboutXMonths: {
one: 'cirka 1 måned',
other: 'cirka {{count}} måneder'
},
xMonths: {
one: '1 måned',
other: '{{count}} måneder'
},
aboutXYears: {
one: 'cirka 1 år',
other: 'cirka {{count}} år'
},
xYears: {
one: '1 år',
other: '{{count}} år'
},
overXYears: {
one: 'over 1 år',
other: 'over {{count}} år'
},
almostXYears: {
one: 'næsten 1 år',
other: 'næsten {{count}} år'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'om ' + result
} else {
return result + ' siden'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december']
var weekdays2char = ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
var weekdays3char = ['søn', 'man', 'tir', 'ons', 'tor', 'fre', 'lør']
var weekdaysFull = ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 22 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
standalone: {
one: 'weniger als eine Sekunde',
other: 'weniger als {{count}} Sekunden'
},
withPreposition: {
one: 'weniger als einer Sekunde',
other: 'weniger als {{count}} Sekunden'
}
},
xSeconds: {
standalone: {
one: 'eine Sekunde',
other: '{{count}} Sekunden'
},
withPreposition: {
one: 'einer Sekunde',
other: '{{count}} Sekunden'
}
},
halfAMinute: {
standalone: 'eine halbe Minute',
withPreposition: 'einer halben Minute'
},
lessThanXMinutes: {
standalone: {
one: 'weniger als eine Minute',
other: 'weniger als {{count}} Minuten'
},
withPreposition: {
one: 'weniger als einer Minute',
other: 'weniger als {{count}} Minuten'
}
},
xMinutes: {
standalone: {
one: 'eine Minute',
other: '{{count}} Minuten'
},
withPreposition: {
one: 'einer Minute',
other: '{{count}} Minuten'
}
},
aboutXHours: {
standalone: {
one: 'etwa eine Stunde',
other: 'etwa {{count}} Stunden'
},
withPreposition: {
one: 'etwa einer Stunde',
other: 'etwa {{count}} Stunden'
}
},
xHours: {
standalone: {
one: 'eine Stunde',
other: '{{count}} Stunden'
},
withPreposition: {
one: 'einer Stunde',
other: '{{count}} Stunden'
}
},
xDays: {
standalone: {
one: 'ein Tag',
other: '{{count}} Tage'
},
withPreposition: {
one: 'einem Tag',
other: '{{count}} Tagen'
}
},
aboutXMonths: {
standalone: {
one: 'etwa ein Monat',
other: 'etwa {{count}} Monate'
},
withPreposition: {
one: 'etwa einem Monat',
other: 'etwa {{count}} Monaten'
}
},
xMonths: {
standalone: {
one: 'ein Monat',
other: '{{count}} Monate'
},
withPreposition: {
one: 'einem Monat',
other: '{{count}} Monaten'
}
},
aboutXYears: {
standalone: {
one: 'etwa ein Jahr',
other: 'etwa {{count}} Jahre'
},
withPreposition: {
one: 'etwa einem Jahr',
other: 'etwa {{count}} Jahren'
}
},
xYears: {
standalone: {
one: 'ein Jahr',
other: '{{count}} Jahre'
},
withPreposition: {
one: 'einem Jahr',
other: '{{count}} Jahren'
}
},
overXYears: {
standalone: {
one: 'mehr als ein Jahr',
other: 'mehr als {{count}} Jahre'
},
withPreposition: {
one: 'mehr als einem Jahr',
other: 'mehr als {{count}} Jahren'
}
},
almostXYears: {
standalone: {
one: 'fast ein Jahr',
other: 'fast {{count}} Jahre'
},
withPreposition: {
one: 'fast einem Jahr',
other: 'fast {{count}} Jahren'
}
}
}
function localize (token, count, options) {
options = options || {}
var usageGroup = options.addSuffix
? distanceInWordsLocale[token].withPreposition
: distanceInWordsLocale[token].standalone
var result
if (typeof usageGroup === 'string') {
result = usageGroup
} else if (count === 1) {
result = usageGroup.one
} else {
result = usageGroup.other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'in ' + result
} else {
return 'vor ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in German, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez']
var monthsFull = ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
var weekdays2char = ['So', 'Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa']
var weekdays3char = ['Son', 'Mon', 'Die', 'Mit', 'Don', 'Fre', 'Sam']
var weekdaysFull = ['Sonntag', 'Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 24 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'λιγότερο από ένα δευτερόλεπτο',
other: 'λιγότερο από {{count}} δευτερόλεπτα'
},
xSeconds: {
one: '1 δευτερόλεπτο',
other: '{{count}} δευτερόλεπτα'
},
halfAMinute: 'μισό λεπτό',
lessThanXMinutes: {
one: 'λιγότερο από ένα λεπτό',
other: 'λιγότερο από {{count}} λεπτά'
},
xMinutes: {
one: '1 λεπτό',
other: '{{count}} λεπτά'
},
aboutXHours: {
one: 'περίπου 1 ώρα',
other: 'περίπου {{count}} ώρες'
},
xHours: {
one: '1 ώρα',
other: '{{count}} ώρες'
},
xDays: {
one: '1 ημέρα',
other: '{{count}} ημέρες'
},
aboutXMonths: {
one: 'περίπου 1 μήνας',
other: 'περίπου {{count}} μήνες'
},
xMonths: {
one: '1 μήνας',
other: '{{count}} μήνες'
},
aboutXYears: {
one: 'περίπου 1 χρόνο',
other: 'περίπου {{count}} χρόνια'
},
xYears: {
one: '1 χρόνο',
other: '{{count}} χρόνια'
},
overXYears: {
one: 'πάνω από 1 χρόνο',
other: 'πάνω από {{count}} χρόνια'
},
almostXYears: {
one: 'περίπου 1 χρόνο',
other: 'περίπου {{count}} χρόνια'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'σε ' + result
} else {
return result + ' πρίν'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['Ιαν', 'Φεβ', 'Μαρ', 'Απρ', 'Μαϊ', 'Ιουν', 'Ιουλ', 'Αυγ', 'Σεπ', 'Οκτ', 'Νοε', 'Δεκ']
var monthsFull = ['Ιανουάριος', 'Φεβρουάριος', 'Μάρτιος', 'Απρίλιος', 'Μάιος', 'Ιούνιος', 'Ιούλιος', 'Αύγουστος', 'Σεπτέμβριος', 'Οκτώβριος', 'Νοέμβριος', 'Δεκέμβριος']
var monthsGenitive = ['Ιανουαρίου', 'Φεβρουαρίου', 'Μαρτίου', 'Απριλίου', 'Μαΐου', 'Ιουνίου', 'Ιουλίου', 'Αυγούστου', 'Σεπτεμβρίου', 'Οκτωβρίου', 'Νοεμβρίου', 'Δεκεμβρίου']
var weekdays2char = ['Κυ', 'Δε', 'Τρ', 'Τε', 'Πέ', 'Πα', 'Σά']
var weekdays3char = ['Κυρ', 'Δευ', 'Τρί', 'Τετ', 'Πέμ', 'Παρ', 'Σάβ']
var weekdaysFull = ['Κυριακή', 'Δευτέρα', 'Τρίτη', 'Τετάρτη', 'Πέμπτη', 'Παρασκευή', 'Σάββατο']
var meridiemUppercase = ['ΠΜ', 'ΜΜ']
var meridiemLowercase = ['πμ', 'μμ']
var meridiemFull = ['π.μ.', 'μ.μ.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalGenders = {
'M': 'ος',
'D': 'η',
'DDD': 'η',
'd': 'η',
'Q': 'ο',
'W': 'η'
}
var ordinalKeys = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalKeys.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return formatters[formatterToken](date) + ordinalGenders[formatterToken]
}
})
// Generate genitive variant of full months
var formatsWithGenitive = ['D', 'Do', 'DD']
formatsWithGenitive.forEach(function (formatterToken) {
formatters[formatterToken + ' MMMM'] = function (date, commonFormatters) {
var formatter = formatters[formatterToken] || commonFormatters[formatterToken]
return formatter(date, commonFormatters) + ' ' + monthsGenitive[date.getMonth()]
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 26 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'malpli ol sekundo',
other: 'malpli ol {{count}} sekundoj'
},
xSeconds: {
one: '1 sekundo',
other: '{{count}} sekundoj'
},
halfAMinute: 'duonminuto',
lessThanXMinutes: {
one: 'malpli ol minuto',
other: 'malpli ol {{count}} minutoj'
},
xMinutes: {
one: '1 minuto',
other: '{{count}} minutoj'
},
aboutXHours: {
one: 'proksimume 1 horo',
other: 'proksimume {{count}} horoj'
},
xHours: {
one: '1 horo',
other: '{{count}} horoj'
},
xDays: {
one: '1 tago',
other: '{{count}} tagoj'
},
aboutXMonths: {
one: 'proksimume 1 monato',
other: 'proksimume {{count}} monatoj'
},
xMonths: {
one: '1 monato',
other: '{{count}} monatoj'
},
aboutXYears: {
one: 'proksimume 1 jaro',
other: 'proksimume {{count}} jaroj'
},
xYears: {
one: '1 jaro',
other: '{{count}} jaroj'
},
overXYears: {
one: 'pli ol 1 jaro',
other: 'pli ol {{count}} jaroj'
},
almostXYears: {
one: 'preskaŭ 1 jaro',
other: 'preskaŭ {{count}} jaroj'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'post ' + result
} else {
return 'antaŭ ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aŭg', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['januaro', 'februaro', 'marto', 'aprilo', 'majo', 'junio', 'julio', 'aŭgusto', 'septembro', 'oktobro', 'novembro', 'decembro']
var weekdays2char = ['di', 'lu', 'ma', 'me', 'ĵa', 've', 'sa']
var weekdays3char = ['dim', 'lun', 'mar', 'mer', 'ĵaŭ', 'ven', 'sab']
var weekdaysFull = ['dimanĉo', 'lundo', 'mardo', 'merkredo', 'ĵaŭdo', 'vendredo', 'sabato']
var meridiemUppercase = ['A.T.M.', 'P.T.M.']
var meridiemLowercase = ['a.t.m.', 'p.t.m.']
var meridiemFull = ['antaŭtagmeze', 'posttagmeze']
var formatters = {
// Month: jan, feb, ..., deс
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: januaro, februaro, ..., decembro
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: di, lu, ..., sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: dim, lun, ..., sab
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: dimanĉo, lundo, ..., sabato
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// A.T.M., P.T.M.
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// a.t.m., p.t.m.
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// antaŭtagmeze, posttagmeze
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return formatters[formatterToken](date) + '-a'
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 28 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'menos de un segundo',
other: 'menos de {{count}} segundos'
},
xSeconds: {
one: '1 segundo',
other: '{{count}} segundos'
},
halfAMinute: 'medio minuto',
lessThanXMinutes: {
one: 'menos de un minuto',
other: 'menos de {{count}} minutos'
},
xMinutes: {
one: '1 minuto',
other: '{{count}} minutos'
},
aboutXHours: {
one: 'alrededor de 1 hora',
other: 'alrededor de {{count}} horas'
},
xHours: {
one: '1 hora',
other: '{{count}} horas'
},
xDays: {
one: '1 día',
other: '{{count}} días'
},
aboutXMonths: {
one: 'alrededor de 1 mes',
other: 'alrededor de {{count}} meses'
},
xMonths: {
one: '1 mes',
other: '{{count}} meses'
},
aboutXYears: {
one: 'alrededor de 1 año',
other: 'alrededor de {{count}} años'
},
xYears: {
one: '1 año',
other: '{{count}} años'
},
overXYears: {
one: 'más de 1 año',
other: 'más de {{count}} años'
},
almostXYears: {
one: 'casi 1 año',
other: 'casi {{count}} años'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'en ' + result
} else {
return 'hace ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['ene', 'feb', 'mar', 'abr', 'may', 'jun', 'jul', 'ago', 'sep', 'oct', 'nov', 'dic']
var monthsFull = ['enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre']
var weekdays2char = ['do', 'lu', 'ma', 'mi', 'ju', 'vi', 'sa']
var weekdays3char = ['dom', 'lun', 'mar', 'mié', 'jue', 'vie', 'sáb']
var weekdaysFull = ['domingo', 'lunes', 'martes', 'miércoles', 'jueves', 'viernes', 'sábado']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + 'º'
}
module.exports = buildFormatLocale
/***/ }),
/* 30 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
function futureSeconds (text) {
return text.replace(/sekuntia?/, 'sekunnin')
}
function futureMinutes (text) {
return text.replace(/minuuttia?/, 'minuutin')
}
function futureHours (text) {
return text.replace(/tuntia?/, 'tunnin')
}
function futureDays (text) {
return text.replace(/päivää?/, 'päivän')
}
function futureMonths (text) {
return text.replace(/(kuukausi|kuukautta)/, 'kuukauden')
}
function futureYears (text) {
return text.replace(/(vuosi|vuotta)/, 'vuoden')
}
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'alle sekunti',
other: 'alle {{count}} sekuntia',
futureTense: futureSeconds
},
xSeconds: {
one: 'sekunti',
other: '{{count}} sekuntia',
futureTense: futureSeconds
},
halfAMinute: {
one: 'puoli minuuttia',
other: 'puoli minuuttia',
futureTense: function (text) {
return 'puolen minuutin'
}
},
lessThanXMinutes: {
one: 'alle minuutti',
other: 'alle {{count}} minuuttia',
futureTense: futureMinutes
},
xMinutes: {
one: 'minuutti',
other: '{{count}} minuuttia',
futureTense: futureMinutes
},
aboutXHours: {
one: 'noin tunti',
other: 'noin {{count}} tuntia',
futureTense: futureHours
},
xHours: {
one: 'tunti',
other: '{{count}} tuntia',
futureTense: futureHours
},
xDays: {
one: 'päivä',
other: '{{count}} päivää',
futureTense: futureDays
},
aboutXMonths: {
one: 'noin kuukausi',
other: 'noin {{count}} kuukautta',
futureTense: futureMonths
},
xMonths: {
one: 'kuukausi',
other: '{{count}} kuukautta',
futureTense: futureMonths
},
aboutXYears: {
one: 'noin vuosi',
other: 'noin {{count}} vuotta',
futureTense: futureYears
},
xYears: {
one: 'vuosi',
other: '{{count}} vuotta',
futureTense: futureYears
},
overXYears: {
one: 'yli vuosi',
other: 'yli {{count}} vuotta',
futureTense: futureYears
},
almostXYears: {
one: 'lähes vuosi',
other: 'lähes {{count}} vuotta',
futureTense: futureYears
}
}
function localize (token, count, options) {
options = options || {}
var distance = distanceInWordsLocale[token]
var result = count === 1 ? distance.one : distance.other.replace('{{count}}', count)
if (options.addSuffix) {
if (options.comparison > 0) {
return distance.futureTense(result) + ' kuluttua'
} else {
return result + ' sitten'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['tammi', 'helmi', 'maalis', 'huhti', 'touko', 'kesä', 'heinä', 'elo', 'syys', 'loka', 'marras', 'joulu']
var monthsFull = ['tammikuu', 'helmikuu', 'maaliskuu', 'huhtikuu', 'toukokuu', 'kesäkuu', 'heinäkuu', 'elokuu', 'syyskuu', 'lokakuu', 'marraskuu', 'joulukuu']
var weekdays2char = ['su', 'ma', 'ti', 'ke', 'to', 'pe', 'la']
var weekdaysFull = ['sunnuntai', 'maanantai', 'tiistai', 'keskiviikko', 'torstai', 'perjantai', 'lauantai']
// In Finnish `a.m.` / `p.m.` are virtually never used, but it seems `AP` (aamupäivä) / `IP` (iltapäivä) are acknowleded terms:
// https://fi.wikipedia.org/wiki/24_tunnin_kello
function meridiem (date) {
return date.getHours() < 12 ? 'AP' : 'IP'
}
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
// Finnish doesn't use two-char weekdays
return weekdays2char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': meridiem,
// am, pm
'a': meridiem,
// a.m., p.m.
'aa': meridiem
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return formatters[formatterToken](date).toString() + '.'
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 32 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'mas maliit sa isang segundo',
other: 'mas maliit sa {{count}} segundo'
},
xSeconds: {
one: '1 segundo',
other: '{{count}} segundo'
},
halfAMinute: 'kalahating minuto',
lessThanXMinutes: {
one: 'mas maliit sa isang minuto',
other: 'mas maliit sa {{count}} minuto'
},
xMinutes: {
one: '1 minuto',
other: '{{count}} minuto'
},
aboutXHours: {
one: 'mga 1 oras',
other: 'mga {{count}} oras'
},
xHours: {
one: '1 oras',
other: '{{count}} oras'
},
xDays: {
one: '1 araw',
other: '{{count}} araw'
},
aboutXMonths: {
one: 'mga 1 buwan',
other: 'mga {{count}} buwan'
},
xMonths: {
one: '1 buwan',
other: '{{count}} buwan'
},
aboutXYears: {
one: 'mga 1 taon',
other: 'mga {{count}} taon'
},
xYears: {
one: '1 taon',
other: '{{count}} taon'
},
overXYears: {
one: 'higit sa 1 taon',
other: 'higit sa {{count}} taon'
},
almostXYears: {
one: 'halos 1 taon',
other: 'halos {{count}} taon'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'sa loob ng ' + result
} else {
return result + ' ang nakalipas'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['Ene', 'Peb', 'Mar', 'Abr', 'May', 'Hun', 'Hul', 'Ago', 'Set', 'Okt', 'Nob', 'Dis']
var monthsFull = ['Enero', 'Pebrero', 'Marso', 'Abril', 'Mayo', 'Hunyo', 'Hulyo', 'Agosto', 'Setyembre', 'Oktubre', 'Nobyembre', 'Disyembre']
var weekdays2char = ['Li', 'Lu', 'Ma', 'Mi', 'Hu', 'Bi', 'Sa']
var weekdays3char = ['Lin', 'Lun', 'Mar', 'Miy', 'Huw', 'Biy', 'Sab']
var weekdaysFull = ['Linggo', 'Lunes', 'Martes', 'Miyerkules', 'Huwebes', 'Biyernes', 'Sabado']
var meridiemUppercase = ['NU', 'NT', 'NH', 'NG']
var meridiemLowercase = ['nu', 'nt', 'nh', 'ng']
var meridiemFull = ['ng umaga', 'ng tanghali', 'ng hapon', 'ng gabi']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
if (date.getHours() > 12) {
var modulo = date.getHours() % 12
if (modulo < 6) {
return meridiemUppercase[2]
} else {
return meridiemUppercase[3]
}
} else if (date.getHours() < 12) {
return meridiemUppercase[0]
} else {
return meridiemUppercase[1]
}
},
// am, pm
'a': function (date) {
if (date.getHours() > 12) {
var modulo = date.getHours() % 12
if (modulo < 6) {
return meridiemLowercase[2]
} else {
return meridiemLowercase[3]
}
} else if (date.getHours() < 12) {
return meridiemLowercase[0]
} else {
return meridiemLowercase[1]
}
},
// a.m., p.m.
'aa': function (date) {
if (date.getHours() > 12) {
var modulo = date.getHours() % 12
if (modulo < 6) {
return meridiemFull[2]
} else {
return meridiemFull[3]
}
} else if (date.getHours() < 12) {
return meridiemFull[0]
} else {
return meridiemFull[1]
}
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return 'ika-' + number
}
module.exports = buildFormatLocale
/***/ }),
/* 34 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'moins d’une seconde',
other: 'moins de {{count}} secondes'
},
xSeconds: {
one: '1 seconde',
other: '{{count}} secondes'
},
halfAMinute: '30 secondes',
lessThanXMinutes: {
one: 'moins d’une minute',
other: 'moins de {{count}} minutes'
},
xMinutes: {
one: '1 minute',
other: '{{count}} minutes'
},
aboutXHours: {
one: 'environ 1 heure',
other: 'environ {{count}} heures'
},
xHours: {
one: '1 heure',
other: '{{count}} heures'
},
xDays: {
one: '1 jour',
other: '{{count}} jours'
},
aboutXMonths: {
one: 'environ 1 mois',
other: 'environ {{count}} mois'
},
xMonths: {
one: '1 mois',
other: '{{count}} mois'
},
aboutXYears: {
one: 'environ 1 an',
other: 'environ {{count}} ans'
},
xYears: {
one: '1 an',
other: '{{count}} ans'
},
overXYears: {
one: 'plus d’un an',
other: 'plus de {{count}} ans'
},
almostXYears: {
one: 'presqu’un an',
other: 'presque {{count}} ans'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'dans ' + result
} else {
return 'il y a ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juill.', 'août', 'sept.', 'oct.', 'nov.', 'déc.']
var monthsFull = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre']
var weekdays2char = ['di', 'lu', 'ma', 'me', 'je', 've', 'sa']
var weekdays3char = ['dim.', 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.']
var weekdaysFull = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['du matin', 'de l’après-midi', 'du soir']
var formatters = {
// Month: Jan, Feb, …, Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, …, December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, …, Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, …, Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, …, Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
var hours = date.getHours()
if (hours <= 12) {
return meridiemFull[0]
}
if (hours <= 16) {
return meridiemFull[1]
}
return meridiemFull[2]
},
// ISO week, ordinal version: 1st, 2nd, …, 53rd
// NOTE: Week has feminine grammatical gender in French: semaine
'Wo': function (date, formatters) {
return feminineOrdinal(formatters.W(date))
}
}
// Generate ordinal version of formatters: M → Mo, D → Do, etc.
// NOTE: For words with masculine grammatical gender in French: mois, jour, trimestre
var formatterTokens = ['M', 'D', 'DDD', 'd', 'Q']
formatterTokens.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return masculineOrdinal(formatters[formatterToken](date))
}
})
// Special case for day of month ordinals in long date format context:
// 1er mars, 2 mars, 3 mars, …
// See https://github.com/date-fns/date-fns/issues/437
//
// NOTE: The below implementation works because parsing of tokens inside a
// format string is done by a greedy regular expression, i.e. longer tokens
// have priority. E.g. formatter for "Do MMMM" has priority over individual
// formatters for "Do" and "MMMM".
var monthsTokens = ['MMM', 'MMMM']
monthsTokens.forEach(function (monthToken) {
formatters['Do ' + monthToken] = function (date, commonFormatters) {
var dayOfMonthToken = date.getDate() === 1
? 'Do'
: 'D'
var dayOfMonthFormatter = formatters[dayOfMonthToken] || commonFormatters[dayOfMonthToken]
return dayOfMonthFormatter(date, commonFormatters) + ' ' + formatters[monthToken](date)
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function masculineOrdinal (number) {
if (number === 1) {
return '1er'
}
return number + 'e'
}
function feminineOrdinal (number) {
if (number === 1) {
return '1re'
}
return number + 'e'
}
module.exports = buildFormatLocale
/***/ }),
/* 36 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: {
standalone: 'manje od 1 sekunde',
withPrepositionAgo: 'manje od 1 sekunde',
withPrepositionIn: 'manje od 1 sekundu'
},
dual: 'manje od {{count}} sekunde',
other: 'manje od {{count}} sekundi'
},
xSeconds: {
one: {
standalone: '1 sekunda',
withPrepositionAgo: '1 sekunde',
withPrepositionIn: '1 sekundu'
},
dual: '{{count}} sekunde',
other: '{{count}} sekundi'
},
halfAMinute: 'pola minute',
lessThanXMinutes: {
one: {
standalone: 'manje od 1 minute',
withPrepositionAgo: 'manje od 1 minute',
withPrepositionIn: 'manje od 1 minutu'
},
dual: 'manje od {{count}} minute',
other: 'manje od {{count}} minuta'
},
xMinutes: {
one: {
standalone: '1 minuta',
withPrepositionAgo: '1 minute',
withPrepositionIn: '1 minutu'
},
dual: '{{count}} minute',
other: '{{count}} minuta'
},
aboutXHours: {
one: {
standalone: 'oko 1 sat',
withPrepositionAgo: 'oko 1 sat',
withPrepositionIn: 'oko 1 sat'
},
dual: 'oko {{count}} sata',
other: 'oko {{count}} sati'
},
xHours: {
one: {
standalone: '1 sat',
withPrepositionAgo: '1 sat',
withPrepositionIn: '1 sat'
},
dual: '{{count}} sata',
other: '{{count}} sati'
},
xDays: {
one: {
standalone: '1 dan',
withPrepositionAgo: '1 dan',
withPrepositionIn: '1 dan'
},
dual: '{{count}} dana',
other: '{{count}} dana'
},
aboutXMonths: {
one: {
standalone: 'oko 1 mjesec',
withPrepositionAgo: 'oko 1 mjesec',
withPrepositionIn: 'oko 1 mjesec'
},
dual: 'oko {{count}} mjeseca',
other: 'oko {{count}} mjeseci'
},
xMonths: {
one: {
standalone: '1 mjesec',
withPrepositionAgo: '1 mjesec',
withPrepositionIn: '1 mjesec'
},
dual: '{{count}} mjeseca',
other: '{{count}} mjeseci'
},
aboutXYears: {
one: {
standalone: 'oko 1 godinu',
withPrepositionAgo: 'oko 1 godinu',
withPrepositionIn: 'oko 1 godinu'
},
dual: 'oko {{count}} godine',
other: 'oko {{count}} godina'
},
xYears: {
one: {
standalone: '1 godina',
withPrepositionAgo: '1 godine',
withPrepositionIn: '1 godinu'
},
dual: '{{count}} godine',
other: '{{count}} godina'
},
overXYears: {
one: {
standalone: 'preko 1 godinu',
withPrepositionAgo: 'preko 1 godinu',
withPrepositionIn: 'preko 1 godinu'
},
dual: 'preko {{count}} godine',
other: 'preko {{count}} godina'
},
almostXYears: {
one: {
standalone: 'gotovo 1 godinu',
withPrepositionAgo: 'gotovo 1 godinu',
withPrepositionIn: 'gotovo 1 godinu'
},
dual: 'gotovo {{count}} godine',
other: 'gotovo {{count}} godina'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
if (options.addSuffix) {
if (options.comparison > 0) {
result = distanceInWordsLocale[token].one.withPrepositionIn
} else {
result = distanceInWordsLocale[token].one.withPrepositionAgo
}
} else {
result = distanceInWordsLocale[token].one.standalone
}
} else if (
count % 10 > 1 && count % 10 < 5 && // if last digit is between 2 and 4
String(count).substr(-2, 1) !== '1' // unless the 2nd to last digit is "1"
) {
result = distanceInWordsLocale[token].dual.replace('{{count}}', count)
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'za ' + result
} else {
return 'prije ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['sij', 'velj', 'ožu', 'tra', 'svi', 'lip', 'srp', 'kol', 'ruj', 'lis', 'stu', 'pro']
var monthsFull = ['siječanj', 'veljača', 'ožujak', 'travanj', 'svibanj', 'lipanj', 'srpanj', 'kolovoz', 'rujan', 'listopad', 'studeni', 'prosinac']
var monthsGenitive = ['siječnja', 'veljače', 'ožujka', 'travnja', 'svibnja', 'lipnja', 'srpnja', 'kolovoza', 'rujna', 'listopada', 'studenog', 'prosinca']
var weekdays2char = ['ne', 'po', 'ut', 'sr', 'če', 'pe', 'su']
var weekdays3char = ['ned', 'pon', 'uto', 'sri', 'čet', 'pet', 'sub']
var weekdaysFull = ['nedjelja', 'ponedjeljak', 'utorak', 'srijeda', 'četvrtak', 'petak', 'subota']
var meridiemUppercase = ['ujutro', 'popodne']
var meridiemLowercase = ['ujutro', 'popodne']
var meridiemFull = ['ujutro', 'popodne']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
// Generate formatters like 'D MMMM', where the month is in the genitive case
var monthsGenitiveFormatters = ['D', 'Do', 'DD']
monthsGenitiveFormatters.forEach(function (formatterToken) {
formatters[formatterToken + ' MMM'] = function (date, commonFormatters) {
var formatter = formatters[formatterToken] || commonFormatters[formatterToken]
return formatter(date, commonFormatters) + ' ' + monthsGenitive[date.getMonth()]
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 38 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'kevesebb, mint egy másodperce',
other: 'kevesebb, mint {{count}} másodperce'
},
xSeconds: {
one: '1 másodperce',
other: '{{count}} másodperce'
},
halfAMinute: 'fél perce',
lessThanXMinutes: {
one: 'kevesebb, mint egy perce',
other: 'kevesebb, mint {{count}} perce'
},
xMinutes: {
one: '1 perce',
other: '{{count}} perce'
},
aboutXHours: {
one: 'közel 1 órája',
other: 'közel {{count}} órája'
},
xHours: {
one: '1 órája',
other: '{{count}} órája'
},
xDays: {
one: '1 napja',
other: '{{count}} napja'
},
aboutXMonths: {
one: 'közel 1 hónapja',
other: 'közel {{count}} hónapja'
},
xMonths: {
one: '1 hónapja',
other: '{{count}} hónapja'
},
aboutXYears: {
one: 'közel 1 éve',
other: 'közel {{count}} éve'
},
xYears: {
one: '1 éve',
other: '{{count}} éve'
},
overXYears: {
one: 'több, mint 1 éve',
other: 'több, mint {{count}} éve'
},
almostXYears: {
one: 'majdnem 1 éve',
other: 'majdnem {{count}} éve'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return '' + result
} else {
return result + ''
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in English, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún', 'Júl', 'Aug', 'Sze', 'Okt', 'Nov', 'Dec']
var monthsFull = ['Január', 'Február', 'Március', 'Április', 'Május', 'Június', 'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December']
var weekdays2char = ['Va', 'Hé', 'Ke', 'Sze', 'Cs', 'Pé', 'Szo']
var weekdays3char = ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo']
var weekdaysFull = ['Vasárnap', 'Hétfő', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat']
var meridiemUppercase = ['DE', 'DU']
var meridiemLowercase = ['de', 'du']
var meridiemFull = ['délelőtt', 'délután']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + 'st'
case 2:
return number + 'nd'
case 3:
return number + 'rd'
}
}
return number + 'th'
}
module.exports = buildFormatLocale
/***/ }),
/* 40 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'kurang dari 1 detik',
other: 'kurang dari {{count}} detik'
},
xSeconds: {
one: '1 detik',
other: '{{count}} detik'
},
halfAMinute: 'setengah menit',
lessThanXMinutes: {
one: 'kurang dari 1 menit',
other: 'kurang dari {{count}} menit'
},
xMinutes: {
one: '1 menit',
other: '{{count}} menit'
},
aboutXHours: {
one: 'sekitar 1 jam',
other: 'sekitar {{count}} jam'
},
xHours: {
one: '1 jam',
other: '{{count}} jam'
},
xDays: {
one: '1 hari',
other: '{{count}} hari'
},
aboutXMonths: {
one: 'sekitar 1 bulan',
other: 'sekitar {{count}} bulan'
},
xMonths: {
one: '1 bulan',
other: '{{count}} bulan'
},
aboutXYears: {
one: 'sekitar 1 tahun',
other: 'sekitar {{count}} tahun'
},
xYears: {
one: '1 tahun',
other: '{{count}} tahun'
},
overXYears: {
one: 'lebih dari 1 tahun',
other: 'lebih dari {{count}} tahun'
},
almostXYears: {
one: 'hampir 1 tahun',
other: 'hampir {{count}} tahun'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'dalam waktu ' + result
} else {
return result + ' yang lalu'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in Indonesian, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des']
var monthsFull = ['Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember']
var weekdays2char = ['Mi', 'Sn', 'Sl', 'Ra', 'Ka', 'Ju', 'Sa']
var weekdays3char = ['Min', 'Sen', 'Sel', 'Rab', 'Kam', 'Jum', 'Sab']
var weekdaysFull = ['Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
switch (number) {
case 1:
return 'pertama'
case 2:
return 'kedua'
case 3:
return 'ketiga'
default:
return 'ke-' + number
}
}
module.exports = buildFormatLocale
/***/ }),
/* 42 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'minna en 1 sekúnda',
other: 'minna en {{count}} sekúndur'
},
xSeconds: {
one: '1 sekúnda',
other: '{{count}} sekúndur'
},
halfAMinute: 'hálf mínúta',
lessThanXMinutes: {
one: 'minna en 1 mínúta',
other: 'minna en {{count}} mínútur'
},
xMinutes: {
one: '1 mínúta',
other: '{{count}} mínútur'
},
aboutXHours: {
one: 'u.þ.b. 1 klukkustund',
other: 'u.þ.b. {{count}} klukkustundir'
},
xHours: {
one: '1 klukkustund',
other: '{{count}} klukkustundir'
},
xDays: {
one: '1 dagur',
other: '{{count}} dagar'
},
aboutXMonths: {
one: 'u.þ.b. 1 mánuður',
other: 'u.þ.b. {{count}} mánuðir'
},
xMonths: {
one: '1 mánuður',
other: '{{count}} mánuðir'
},
aboutXYears: {
one: 'u.þ.b. 1 ár',
other: 'u.þ.b. {{count}} ár'
},
xYears: {
one: '1 ár',
other: '{{count}} ár'
},
overXYears: {
one: 'meira en 1 ár',
other: 'meira en {{count}} ár'
},
almostXYears: {
one: 'næstum 1 ár',
other: 'næstum {{count}} ár'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'í ' + result
} else {
return result + ' síðan'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'maí', 'jún', 'júl', 'ágú', 'sep', 'okt', 'nóv', 'des']
var monthsFull = ['janúar', 'febrúar', 'mars', 'apríl', 'maí', 'júní', 'júlí', 'ágúst', 'september', 'október', 'nóvember', 'desember']
var weekdays2char = ['su', 'má', 'þr', 'mi', 'fi', 'fö', 'la']
var weekdays3char = ['sun', 'mán', 'þri', 'mið', 'fim', 'fös', 'lau']
var weekdaysFull = ['sunnudaginn', 'mánudaginn', 'þriðjudaginn', 'miðvikudaginn', 'fimmtudaginn', 'föstudaginn', 'laugardaginn']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return '' + number
}
module.exports = buildFormatLocale
/***/ }),
/* 44 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'meno di un secondo',
other: 'meno di {{count}} secondi'
},
xSeconds: {
one: 'un secondo',
other: '{{count}} secondi'
},
halfAMinute: 'alcuni secondi',
lessThanXMinutes: {
one: 'meno di un minuto',
other: 'meno di {{count}} minuti'
},
xMinutes: {
one: 'un minuto',
other: '{{count}} minuti'
},
aboutXHours: {
one: 'circa un\'ora',
other: 'circa {{count}} ore'
},
xHours: {
one: 'un\'ora',
other: '{{count}} ore'
},
xDays: {
one: 'un giorno',
other: '{{count}} giorni'
},
aboutXMonths: {
one: 'circa un mese',
other: 'circa {{count}} mesi'
},
xMonths: {
one: 'un mese',
other: '{{count}} mesi'
},
aboutXYears: {
one: 'circa un anno',
other: 'circa {{count}} anni'
},
xYears: {
one: 'un anno',
other: '{{count}} anni'
},
overXYears: {
one: 'più di un anno',
other: 'più di {{count}} anni'
},
almostXYears: {
one: 'quasi un anno',
other: 'quasi {{count}} anni'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'tra ' + result
} else {
return result + ' fa'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 45 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['gen', 'feb', 'mar', 'apr', 'mag', 'giu', 'lug', 'ago', 'set', 'ott', 'nov', 'dic']
var monthsFull = ['gennaio', 'febbraio', 'marzo', 'aprile', 'maggio', 'giugno', 'luglio', 'agosto', 'settembre', 'ottobre', 'novembre', 'dicembre']
var weekdays2char = ['do', 'lu', 'ma', 'me', 'gi', 've', 'sa']
var weekdays3char = ['dom', 'lun', 'mar', 'mer', 'gio', 'ven', 'sab']
var weekdaysFull = ['domenica', 'lunedì', 'martedì', 'mercoledì', 'giovedì', 'venerdì', 'sabato']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + 'º'
}
module.exports = buildFormatLocale
/***/ }),
/* 46 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '1秒以下',
other: '{{count}}秒以下'
},
xSeconds: {
one: '1秒',
other: '{{count}}秒'
},
halfAMinute: '30秒ぐらい',
lessThanXMinutes: {
one: '1分以下',
other: '{{count}}分以下'
},
xMinutes: {
one: '1分',
other: '{{count}}分'
},
aboutXHours: {
one: '1時間ぐらい',
other: '{{count}}時間ぐらい'
},
xHours: {
one: '1時間',
other: '{{count}}時間'
},
xDays: {
one: '1日',
other: '{{count}}日'
},
aboutXMonths: {
one: '1ヶ月ぐらい',
other: '{{count}}ヶ月ぐらい'
},
xMonths: {
one: '1ヶ月',
other: '{{count}}ヶ月'
},
aboutXYears: {
one: '1年ぐらい',
other: '{{count}}年ぐらい'
},
xYears: {
one: '1年',
other: '{{count}}年'
},
overXYears: {
one: '1年以上',
other: '{{count}}年以上'
},
almostXYears: {
one: '1年以下',
other: '{{count}}年以下'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + '後'
} else {
return result + '前'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 47 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
var monthsFull = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
var weekdays2char = ['日', '月', '火', '水', '木', '金', '土']
var weekdays3char = ['日曜', '月曜', '火曜', '水曜', '木曜', '金曜', '土曜']
var weekdaysFull = ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日']
var meridiemUppercase = ['午前', '午後']
var meridiemLowercase = ['午前', '午後']
var meridiemFull = ['午前', '午後']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '日'
}
module.exports = buildFormatLocale
/***/ }),
/* 48 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '1초 미만',
other: '{{count}}초 미만'
},
xSeconds: {
one: '1초',
other: '{{count}}초'
},
halfAMinute: '30초',
lessThanXMinutes: {
one: '1분 미만',
other: '{{count}}분 미만'
},
xMinutes: {
one: '1분',
other: '{{count}}분'
},
aboutXHours: {
one: '약 1시간',
other: '약 {{count}}시간'
},
xHours: {
one: '1시간',
other: '{{count}}시간'
},
xDays: {
one: '1일',
other: '{{count}}일'
},
aboutXMonths: {
one: '약 1개월',
other: '약 {{count}}개월'
},
xMonths: {
one: '1개월',
other: '{{count}}개월'
},
aboutXYears: {
one: '약 1년',
other: '약 {{count}}년'
},
xYears: {
one: '1년',
other: '{{count}}년'
},
overXYears: {
one: '1년 이상',
other: '{{count}}년 이상'
},
almostXYears: {
one: '거의 1년',
other: '거의 {{count}}년'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + ' 후'
} else {
return result + ' 전'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 49 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']
var monthsFull = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']
var weekdays2char = ['일', '월', '화', '수', '목', '금', '토']
var weekdays3char = ['일', '월', '화', '수', '목', '금', '토']
var weekdaysFull = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일']
var meridiemUppercase = ['오전', '오후']
var meridiemLowercase = ['오전', '오후']
var meridiemFull = ['오전', '오후']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '일'
}
module.exports = buildFormatLocale
/***/ }),
/* 50 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'помалку од секунда',
other: 'помалку од {{count}} секунди'
},
xSeconds: {
one: '1 секунда',
other: '{{count}} секунди'
},
halfAMinute: 'половина минута',
lessThanXMinutes: {
one: 'помалку од минута',
other: 'помалку од {{count}} минути'
},
xMinutes: {
one: '1 минута',
other: '{{count}} минути'
},
aboutXHours: {
one: 'околу 1 час',
other: 'околу {{count}} часа'
},
xHours: {
one: '1 час',
other: '{{count}} часа'
},
xDays: {
one: '1 ден',
other: '{{count}} дена'
},
aboutXMonths: {
one: 'околу 1 месец',
other: 'околу {{count}} месеци'
},
xMonths: {
one: '1 месец',
other: '{{count}} месеци'
},
aboutXYears: {
one: 'околу 1 година',
other: 'околу {{count}} години'
},
xYears: {
one: '1 година',
other: '{{count}} години'
},
overXYears: {
one: 'повеќе од 1 година',
other: 'повеќе од {{count}} години'
},
almostXYears: {
one: 'безмалку 1 година',
other: 'безмалку {{count}} години'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'за ' + result
} else {
return 'пред ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 51 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['јан', 'фев', 'мар', 'апр', 'мај', 'јун', 'јул', 'авг', 'сеп', 'окт', 'ное', 'дек']
var monthsFull = ['јануари', 'февруари', 'март', 'април', 'мај', 'јуни', 'јули', 'август', 'септември', 'октомври', 'ноември', 'декември']
var weekdays2char = ['не', 'по', 'вт', 'ср', 'че', 'пе', 'са']
var weekdays3char = ['нед', 'пон', 'вто', 'сре', 'чет', 'пет', 'саб']
var weekdaysFull = ['недела', 'понеделник', 'вторник', 'среда', 'четврток', 'петок', 'сабота']
var meridiem = ['претпладне', 'попладне']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiem[1] : meridiem[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiem[1] : meridiem[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiem[1] : meridiem[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
return number + '-ви'
case 2:
return number + '-ри'
case 7:
case 8:
return number + '-ми'
}
}
return number + '-ти'
}
module.exports = buildFormatLocale
/***/ }),
/* 52 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'mindre enn ett sekund',
other: 'mindre enn {{count}} sekunder'
},
xSeconds: {
one: 'ett sekund',
other: '{{count}} sekunder'
},
halfAMinute: 'et halvt minutt',
lessThanXMinutes: {
one: 'mindre enn ett minutt',
other: 'mindre enn {{count}} minutter'
},
xMinutes: {
one: 'ett minutt',
other: '{{count}} minutter'
},
aboutXHours: {
one: 'rundt en time',
other: 'rundt {{count}} timer'
},
xHours: {
one: 'en time',
other: '{{count}} timer'
},
xDays: {
one: 'en dag',
other: '{{count}} dager'
},
aboutXMonths: {
one: 'rundt en måned',
other: 'rundt {{count}} måneder'
},
xMonths: {
one: 'en måned',
other: '{{count}} måneder'
},
aboutXYears: {
one: 'rundt ett år',
other: 'rundt {{count}} år'
},
xYears: {
one: 'ett år',
other: '{{count}} år'
},
overXYears: {
one: 'over ett år',
other: 'over {{count}} år'
},
almostXYears: {
one: 'nesten ett år',
other: 'nesten {{count}} år'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'om ' + result
} else {
return result + ' siden'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 53 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan.', 'feb.', 'mars', 'april', 'mai', 'juni', 'juli', 'aug.', 'sep.', 'okt.', 'nov.', 'des.']
var monthsFull = ['januar', 'februar', 'mars', 'april', 'mai', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'desember']
var weekdays2char = ['sø', 'ma', 'ti', 'on', 'to', 'fr', 'lø']
var weekdays3char = ['sø.', 'ma.', 'ti.', 'on.', 'to.', 'fr.', 'lø.']
var weekdaysFull = ['søndag', 'mandag', 'tirsdag', 'onsdag', 'torsdag', 'fredag', 'lørdag']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 54 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'minder dan een seconde',
other: 'minder dan {{count}} seconden'
},
xSeconds: {
one: '1 seconde',
other: '{{count}} seconden'
},
halfAMinute: 'een halve minuut',
lessThanXMinutes: {
one: 'minder dan een minuut',
other: 'minder dan {{count}} minuten'
},
xMinutes: {
one: 'een minuut',
other: '{{count}} minuten'
},
aboutXHours: {
one: 'ongeveer 1 uur',
other: 'ongeveer {{count}} uur'
},
xHours: {
one: '1 uur',
other: '{{count}} uur'
},
xDays: {
one: '1 dag',
other: '{{count}} dagen'
},
aboutXMonths: {
one: 'ongeveer 1 maand',
other: 'ongeveer {{count}} maanden'
},
xMonths: {
one: '1 maand',
other: '{{count}} maanden'
},
aboutXYears: {
one: 'ongeveer 1 jaar',
other: 'ongeveer {{count}} jaar'
},
xYears: {
one: '1 jaar',
other: '{{count}} jaar'
},
overXYears: {
one: 'meer dan 1 jaar',
other: 'meer dan {{count}} jaar'
},
almostXYears: {
one: 'bijna 1 jaar',
other: 'bijna {{count}} jaar'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'over ' + result
} else {
return result + ' geleden'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 55 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'mei', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['januari', 'februari', 'maart', 'april', 'mei', 'juni', 'juli', 'augustus', 'september', 'oktober', 'november', 'december']
var weekdays2char = ['zo', 'ma', 'di', 'wo', 'do', 'vr', 'za']
var weekdays3char = ['zon', 'maa', 'din', 'woe', 'don', 'vri', 'zat']
var weekdaysFull = ['zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + 'e'
}
module.exports = buildFormatLocale
/***/ }),
/* 56 */
/***/ (function(module, exports) {
function declensionGroup (scheme, count) {
if (count === 1) {
return scheme.one
}
var rem100 = count % 100
// ends with 11-20
if (rem100 <= 20 && rem100 > 10) {
return scheme.other
}
var rem10 = rem100 % 10
// ends with 2, 3, 4
if (rem10 >= 2 && rem10 <= 4) {
return scheme.twoFour
}
return scheme.other
}
function declension (scheme, count, time) {
time = time || 'regular'
var group = declensionGroup(scheme, count)
var finalText = group[time] || group
return finalText.replace('{{count}}', count)
}
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: {
regular: 'mniej niż sekunda',
past: 'mniej niż sekundę',
future: 'mniej niż sekundę'
},
twoFour: 'mniej niż {{count}} sekundy',
other: 'mniej niż {{count}} sekund'
},
xSeconds: {
one: {
regular: 'sekunda',
past: 'sekundę',
future: 'sekundę'
},
twoFour: '{{count}} sekundy',
other: '{{count}} sekund'
},
halfAMinute: {
one: 'pół minuty',
twoFour: 'pół minuty',
other: 'pół minuty'
},
lessThanXMinutes: {
one: {
regular: 'mniej niż minuta',
past: 'mniej niż minutę',
future: 'mniej niż minutę'
},
twoFour: 'mniej niż {{count}} minuty',
other: 'mniej niż {{count}} minut'
},
xMinutes: {
one: {
regular: 'minuta',
past: 'minutę',
future: 'minutę'
},
twoFour: '{{count}} minuty',
other: '{{count}} minut'
},
aboutXHours: {
one: {
regular: 'około godzina',
past: 'około godziny',
future: 'około godzinę'
},
twoFour: 'około {{count}} godziny',
other: 'około {{count}} godzin'
},
xHours: {
one: {
regular: 'godzina',
past: 'godzinę',
future: 'godzinę'
},
twoFour: '{{count}} godziny',
other: '{{count}} godzin'
},
xDays: {
one: {
regular: 'dzień',
past: 'dzień',
future: '1 dzień'
},
twoFour: '{{count}} dni',
other: '{{count}} dni'
},
aboutXMonths: {
one: 'około miesiąc',
twoFour: 'około {{count}} miesiące',
other: 'około {{count}} miesięcy'
},
xMonths: {
one: 'miesiąc',
twoFour: '{{count}} miesiące',
other: '{{count}} miesięcy'
},
aboutXYears: {
one: 'około rok',
twoFour: 'około {{count}} lata',
other: 'około {{count}} lat'
},
xYears: {
one: 'rok',
twoFour: '{{count}} lata',
other: '{{count}} lat'
},
overXYears: {
one: 'ponad rok',
twoFour: 'ponad {{count}} lata',
other: 'ponad {{count}} lat'
},
almostXYears: {
one: 'prawie rok',
twoFour: 'prawie {{count}} lata',
other: 'prawie {{count}} lat'
}
}
function localize (token, count, options) {
options = options || {}
var scheme = distanceInWordsLocale[token]
if (!options.addSuffix) {
return declension(scheme, count)
}
if (options.comparison > 0) {
return 'za ' + declension(scheme, count, 'future')
} else {
return declension(scheme, count, 'past') + ' temu'
}
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 57 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['sty', 'lut', 'mar', 'kwi', 'maj', 'cze', 'lip', 'sie', 'wrz', 'paź', 'lis', 'gru']
var monthsFull = ['styczeń', 'luty', 'marzec', 'kwiecień', 'maj', 'czerwiec', 'lipiec', 'sierpień', 'wrzesień', 'październik', 'listopad', 'grudzień']
var weekdays2char = ['nd', 'pn', 'wt', 'śr', 'cz', 'pt', 'sb']
var weekdays3char = ['niedz.', 'pon.', 'wt.', 'śr.', 'czw.', 'piąt.', 'sob.']
var weekdaysFull = ['niedziela', 'poniedziałek', 'wtorek', 'środa', 'czwartek', 'piątek', 'sobota']
var meridiem = ['w nocy', 'rano', 'po południu', 'wieczorem']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// Time of day
'A': function (date) {
var hours = date.getHours()
if (hours >= 17) {
return meridiem[3]
} else if (hours >= 12) {
return meridiem[2]
} else if (hours >= 4) {
return meridiem[1]
} else {
return meridiem[0]
}
}
}
formatters.a = formatters.A
formatters.aa = formatters.A
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
// Well, it should be just a number without any suffix
return formatters[formatterToken](date).toString()
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 58 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'menos de um segundo',
other: 'menos de {{count}} segundos'
},
xSeconds: {
one: '1 segundo',
other: '{{count}} segundos'
},
halfAMinute: 'meio minuto',
lessThanXMinutes: {
one: 'menos de um minuto',
other: 'menos de {{count}} minutos'
},
xMinutes: {
one: '1 minuto',
other: '{{count}} minutos'
},
aboutXHours: {
one: 'aproximadamente 1 hora',
other: 'aproximadamente {{count}} horas'
},
xHours: {
one: '1 hora',
other: '{{count}} horas'
},
xDays: {
one: '1 dia',
other: '{{count}} dias'
},
aboutXMonths: {
one: 'aproximadamente 1 mês',
other: 'aproximadamente {{count}} meses'
},
xMonths: {
one: '1 mês',
other: '{{count}} meses'
},
aboutXYears: {
one: 'aproximadamente 1 ano',
other: 'aproximadamente {{count}} anos'
},
xYears: {
one: '1 ano',
other: '{{count}} anos'
},
overXYears: {
one: 'mais de 1 ano',
other: 'mais de {{count}} anos'
},
almostXYears: {
one: 'quase 1 ano',
other: 'quase {{count}} anos'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'daqui a ' + result
} else {
return 'há ' + result
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 59 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'fev', 'mar', 'abr', 'mai', 'jun', 'jul', 'ago', 'set', 'out', 'nov', 'dez']
var monthsFull = ['janeiro', 'fevereiro', 'março', 'abril', 'maio', 'junho', 'julho', 'agosto', 'setembro', 'outubro', 'novembro', 'dezembro']
var weekdays2char = ['do', 'se', 'te', 'qa', 'qi', 'se', 'sa']
var weekdays3char = ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sáb']
var weekdaysFull = ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + 'º'
}
module.exports = buildFormatLocale
/***/ }),
/* 60 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'mai puțin de o secundă',
other: 'mai puțin de {{count}} secunde'
},
xSeconds: {
one: '1 secundă',
other: '{{count}} secunde'
},
halfAMinute: 'jumătate de minut',
lessThanXMinutes: {
one: 'mai puțin de un minut',
other: 'mai puțin de {{count}} minute'
},
xMinutes: {
one: '1 minut',
other: '{{count}} minute'
},
aboutXHours: {
one: 'circa 1 oră',
other: 'circa {{count}} ore'
},
xHours: {
one: '1 oră',
other: '{{count}} ore'
},
xDays: {
one: '1 zi',
other: '{{count}} zile'
},
aboutXMonths: {
one: 'circa 1 lună',
other: 'circa {{count}} luni'
},
xMonths: {
one: '1 lună',
other: '{{count}} luni'
},
aboutXYears: {
one: 'circa 1 an',
other: 'circa {{count}} ani'
},
xYears: {
one: '1 an',
other: '{{count}} ani'
},
overXYears: {
one: 'peste 1 an',
other: 'peste {{count}} ani'
},
almostXYears: {
one: 'aproape 1 an',
other: 'aproape {{count}} ani'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'în ' + result
} else {
return result + ' în urmă'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in Romanian language the weekdays and months should be in the lowercase.
var months3char = ['ian', 'feb', 'mar', 'apr', 'mai', 'iun', 'iul', 'aug', 'sep', 'oct', 'noi', 'dec']
var monthsFull = ['ianuarie', 'februarie', 'martie', 'aprilie', 'mai', 'iunie', 'iulie', 'august', 'septembrie', 'octombrie', 'noiembrie', 'decembrie']
var weekdays2char = ['du', 'lu', 'ma', 'mi', 'jo', 'vi', 'sâ']
var weekdays3char = ['dum', 'lun', 'mar', 'mie', 'joi', 'vin', 'sâm']
var weekdaysFull = ['duminică', 'luni', 'marți', 'miercuri', 'joi', 'vineri', 'sâmbăta']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number.toString()
}
module.exports = buildFormatLocale
/***/ }),
/* 62 */
/***/ (function(module, exports) {
function declension (scheme, count) {
// scheme for count=1 exists
if (scheme.one !== undefined && count === 1) {
return scheme.one
}
var rem10 = count % 10
var rem100 = count % 100
// 1, 21, 31, ...
if (rem10 === 1 && rem100 !== 11) {
return scheme.singularNominative.replace('{{count}}', count)
// 2, 3, 4, 22, 23, 24, 32 ...
} else if ((rem10 >= 2 && rem10 <= 4) && (rem100 < 10 || rem100 > 20)) {
return scheme.singularGenitive.replace('{{count}}', count)
// 5, 6, 7, 8, 9, 10, 11, ...
} else {
return scheme.pluralGenitive.replace('{{count}}', count)
}
}
function buildLocalizeTokenFn (scheme) {
return function (count, options) {
if (options.addSuffix) {
if (options.comparison > 0) {
if (scheme.future) {
return declension(scheme.future, count)
} else {
return 'через ' + declension(scheme.regular, count)
}
} else {
if (scheme.past) {
return declension(scheme.past, count)
} else {
return declension(scheme.regular, count) + ' назад'
}
}
} else {
return declension(scheme.regular, count)
}
}
}
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: buildLocalizeTokenFn({
regular: {
one: 'меньше секунды',
singularNominative: 'меньше {{count}} секунды',
singularGenitive: 'меньше {{count}} секунд',
pluralGenitive: 'меньше {{count}} секунд'
},
future: {
one: 'меньше, чем через секунду',
singularNominative: 'меньше, чем через {{count}} секунду',
singularGenitive: 'меньше, чем через {{count}} секунды',
pluralGenitive: 'меньше, чем через {{count}} секунд'
}
}),
xSeconds: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} секунда',
singularGenitive: '{{count}} секунды',
pluralGenitive: '{{count}} секунд'
},
past: {
singularNominative: '{{count}} секунду назад',
singularGenitive: '{{count}} секунды назад',
pluralGenitive: '{{count}} секунд назад'
},
future: {
singularNominative: 'через {{count}} секунду',
singularGenitive: 'через {{count}} секунды',
pluralGenitive: 'через {{count}} секунд'
}
}),
halfAMinute: function (_, options) {
if (options.addSuffix) {
if (options.comparison > 0) {
return 'через полминуты'
} else {
return 'полминуты назад'
}
}
return 'полминуты'
},
lessThanXMinutes: buildLocalizeTokenFn({
regular: {
one: 'меньше минуты',
singularNominative: 'меньше {{count}} минуты',
singularGenitive: 'меньше {{count}} минут',
pluralGenitive: 'меньше {{count}} минут'
},
future: {
one: 'меньше, чем через минуту',
singularNominative: 'меньше, чем через {{count}} минуту',
singularGenitive: 'меньше, чем через {{count}} минуты',
pluralGenitive: 'меньше, чем через {{count}} минут'
}
}),
xMinutes: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} минута',
singularGenitive: '{{count}} минуты',
pluralGenitive: '{{count}} минут'
},
past: {
singularNominative: '{{count}} минуту назад',
singularGenitive: '{{count}} минуты назад',
pluralGenitive: '{{count}} минут назад'
},
future: {
singularNominative: 'через {{count}} минуту',
singularGenitive: 'через {{count}} минуты',
pluralGenitive: 'через {{count}} минут'
}
}),
aboutXHours: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} часа',
singularGenitive: 'около {{count}} часов',
pluralGenitive: 'около {{count}} часов'
},
future: {
singularNominative: 'приблизительно через {{count}} час',
singularGenitive: 'приблизительно через {{count}} часа',
pluralGenitive: 'приблизительно через {{count}} часов'
}
}),
xHours: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} час',
singularGenitive: '{{count}} часа',
pluralGenitive: '{{count}} часов'
}
}),
xDays: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} день',
singularGenitive: '{{count}} дня',
pluralGenitive: '{{count}} дней'
}
}),
aboutXMonths: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} месяца',
singularGenitive: 'около {{count}} месяцев',
pluralGenitive: 'около {{count}} месяцев'
},
future: {
singularNominative: 'приблизительно через {{count}} месяц',
singularGenitive: 'приблизительно через {{count}} месяца',
pluralGenitive: 'приблизительно через {{count}} месяцев'
}
}),
xMonths: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} месяц',
singularGenitive: '{{count}} месяца',
pluralGenitive: '{{count}} месяцев'
}
}),
aboutXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'около {{count}} года',
singularGenitive: 'около {{count}} лет',
pluralGenitive: 'около {{count}} лет'
},
future: {
singularNominative: 'приблизительно через {{count}} год',
singularGenitive: 'приблизительно через {{count}} года',
pluralGenitive: 'приблизительно через {{count}} лет'
}
}),
xYears: buildLocalizeTokenFn({
regular: {
singularNominative: '{{count}} год',
singularGenitive: '{{count}} года',
pluralGenitive: '{{count}} лет'
}
}),
overXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'больше {{count}} года',
singularGenitive: 'больше {{count}} лет',
pluralGenitive: 'больше {{count}} лет'
},
future: {
singularNominative: 'больше, чем через {{count}} год',
singularGenitive: 'больше, чем через {{count}} года',
pluralGenitive: 'больше, чем через {{count}} лет'
}
}),
almostXYears: buildLocalizeTokenFn({
regular: {
singularNominative: 'почти {{count}} год',
singularGenitive: 'почти {{count}} года',
pluralGenitive: 'почти {{count}} лет'
},
future: {
singularNominative: 'почти через {{count}} год',
singularGenitive: 'почти через {{count}} года',
pluralGenitive: 'почти через {{count}} лет'
}
})
}
function localize (token, count, options) {
options = options || {}
return distanceInWordsLocale[token](count, options)
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 63 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// http://new.gramota.ru/spravka/buro/search-answer?s=242637
var monthsShort = ['янв.', 'фев.', 'март', 'апр.', 'май', 'июнь', 'июль', 'авг.', 'сент.', 'окт.', 'нояб.', 'дек.']
var monthsFull = ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь']
var monthsGenitive = ['января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря']
var weekdays2char = ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб']
var weekdays3char = ['вск', 'пнд', 'втр', 'срд', 'чтв', 'птн', 'суб']
var weekdaysFull = ['воскресенье', 'понедельник', 'вторник', 'среда', 'четверг', 'пятница', 'суббота']
var meridiem = ['ночи', 'утра', 'дня', 'вечера']
var formatters = {
// Month: янв., фев., ..., дек.
'MMM': function (date) {
return monthsShort[date.getMonth()]
},
// Month: январь, февраль, ..., декабрь
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: вс, пн, ..., сб
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: вск, пнд, ..., суб
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: воскресенье, понедельник, ..., суббота
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// Time of day: ночи, утра, дня, вечера
'A': function (date) {
var hours = date.getHours()
if (hours >= 17) {
return meridiem[3]
} else if (hours >= 12) {
return meridiem[2]
} else if (hours >= 4) {
return meridiem[1]
} else {
return meridiem[0]
}
},
'Do': function (date, formatters) {
return formatters.D(date) + '-е'
},
'Wo': function (date, formatters) {
return formatters.W(date) + '-я'
}
}
formatters.a = formatters.A
formatters.aa = formatters.A
// Generate ordinal version of formatters: M -> Mo, DDD -> DDDo, etc.
var ordinalFormatters = ['M', 'DDD', 'd', 'Q']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return formatters[formatterToken](date) + '-й'
}
})
// Generate formatters like 'D MMMM',
// where month is in the genitive case: января, февраля, ..., декабря
var monthsGenitiveFormatters = ['D', 'Do', 'DD']
monthsGenitiveFormatters.forEach(function (formatterToken) {
formatters[formatterToken + ' MMMM'] = function (date, commonFormatters) {
var formatter = formatters[formatterToken] || commonFormatters[formatterToken]
return formatter(date, commonFormatters) + ' ' + monthsGenitive[date.getMonth()]
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 64 */
/***/ (function(module, exports) {
function declensionGroup (scheme, count) {
if (count === 1) {
return scheme.one
}
if (count >= 2 && count <= 4) {
return scheme.twoFour
}
// if count === null || count === 0 || count >= 5
return scheme.other
}
function declension (scheme, count, time) {
var group = declensionGroup(scheme, count)
var finalText = group[time] || group
return finalText.replace('{{count}}', count)
}
function extractPreposition (token) {
var result = ['lessThan', 'about', 'over', 'almost'].filter(function (preposition) {
return !!token.match(new RegExp('^' + preposition))
})
return result[0]
}
function prefixPreposition (preposition) {
var translation = ''
if (preposition === 'almost') {
translation = 'takmer'
}
if (preposition === 'about') {
translation = 'približne'
}
return translation.length > 0 ? translation + ' ' : ''
}
function suffixPreposition (preposition) {
var translation = ''
if (preposition === 'lessThan') {
translation = 'menej než'
}
if (preposition === 'over') {
translation = 'viac než'
}
return translation.length > 0 ? translation + ' ' : ''
}
function lowercaseFirstLetter (string) {
return string.charAt(0).toLowerCase() + string.slice(1)
}
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
xSeconds: {
one: {
regular: 'sekunda',
past: 'sekundou',
future: 'sekundu'
},
twoFour: {
regular: '{{count}} sekundy',
past: '{{count}} sekundami',
future: '{{count}} sekundy'
},
other: {
regular: '{{count}} sekúnd',
past: '{{count}} sekundami',
future: '{{count}} sekúnd'
}
},
halfAMinute: {
other: {
regular: 'pol minúty',
past: 'pol minútou',
future: 'pol minúty'
}
},
xMinutes: {
one: {
regular: 'minúta',
past: 'minútou',
future: 'minútu'
},
twoFour: {
regular: '{{count}} minúty',
past: '{{count}} minútami',
future: '{{count}} minúty'
},
other: {
regular: '{{count}} minút',
past: '{{count}} minútami',
future: '{{count}} minút'
}
},
xHours: {
one: {
regular: 'hodina',
past: 'hodinou',
future: 'hodinu'
},
twoFour: {
regular: '{{count}} hodiny',
past: '{{count}} hodinami',
future: '{{count}} hodiny'
},
other: {
regular: '{{count}} hodín',
past: '{{count}} hodinami',
future: '{{count}} hodín'
}
},
xDays: {
one: {
regular: 'deň',
past: 'dňom',
future: 'deň'
},
twoFour: {
regular: '{{count}} dni',
past: '{{count}} dňami',
future: '{{count}} dni'
},
other: {
regular: '{{count}} dní',
past: '{{count}} dňami',
future: '{{count}} dní'
}
},
xMonths: {
one: {
regular: 'mesiac',
past: 'mesiacom',
future: 'mesiac'
},
twoFour: {
regular: '{{count}} mesiace',
past: '{{count}} mesiacmi',
future: '{{count}} mesiace'
},
other: {
regular: '{{count}} mesiacov',
past: '{{count}} mesiacmi',
future: '{{count}} mesiacov'
}
},
xYears: {
one: {
regular: 'rok',
past: 'rokom',
future: 'rok'
},
twoFour: {
regular: '{{count}} roky',
past: '{{count}} rokmi',
future: '{{count}} roky'
},
other: {
regular: '{{count}} rokov',
past: '{{count}} rokmi',
future: '{{count}} rokov'
}
}
}
function localize (token, count, options) {
options = options || {}
var preposition = extractPreposition(token) || ''
var key = lowercaseFirstLetter(token.substring(preposition.length))
var scheme = distanceInWordsLocale[key]
if (!options.addSuffix) {
return prefixPreposition(preposition) + suffixPreposition(preposition) + declension(scheme, count, 'regular')
}
if (options.comparison > 0) {
return prefixPreposition(preposition) + 'za ' + suffixPreposition(preposition) + declension(scheme, count, 'future')
} else {
return prefixPreposition(preposition) + 'pred ' + suffixPreposition(preposition) + declension(scheme, count, 'past')
}
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 65 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'máj', 'jún', 'júl', 'aug', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['január', 'február', 'marec', 'apríl', 'máj', 'jún', 'júl', 'august', 'september', 'október', 'november', 'december']
var weekdays2char = ['ne', 'po', 'ut', 'st', 'št', 'pi', 'so']
var weekdays3char = ['neď', 'pon', 'uto', 'str', 'štv', 'pia', 'sob']
var weekdaysFull = ['nedeľa', 'pondelok', 'utorok', 'streda', 'štvrtok', 'piatok', 'sobota']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: jan, feb, ..., dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: január, február, ..., december
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: ne, po, ..., so
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: neď, pon, ..., sob
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: neďeľa, pondelok, ..., sobota
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 66 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'manj kot sekunda',
two: 'manj kot 2 sekundi',
three: 'manj kot {{count}} sekunde',
other: 'manj kot {{count}} sekund'
},
xSeconds: {
one: '1 sekunda',
two: '2 sekundi',
three: '{{count}} sekunde',
other: '{{count}} sekund'
},
halfAMinute: 'pol minute',
lessThanXMinutes: {
one: 'manj kot minuta',
two: 'manj kot 2 minuti',
three: 'manj kot {{count}} minute',
other: 'manj kot {{count}} minut'
},
xMinutes: {
one: '1 minuta',
two: '2 minuti',
three: '{{count}} minute',
other: '{{count}} minut'
},
aboutXHours: {
one: 'približno 1 ura',
two: 'približno 2 uri',
three: 'približno {{count}} ure',
other: 'približno {{count}} ur'
},
xHours: {
one: '1 ura',
two: '2 uri',
three: '{{count}} ure',
other: '{{count}} ur'
},
xDays: {
one: '1 dan',
two: '2 dni',
three: '{{count}} dni',
other: '{{count}} dni'
},
aboutXMonths: {
one: 'približno 1 mesec',
two: 'približno 2 meseca',
three: 'približno {{count}} mesece',
other: 'približno {{count}} mesecev'
},
xMonths: {
one: '1 mesec',
two: '2 meseca',
three: '{{count}} meseci',
other: '{{count}} mesecev'
},
aboutXYears: {
one: 'približno 1 leto',
two: 'približno 2 leti',
three: 'približno {{count}} leta',
other: 'približno {{count}} let'
},
xYears: {
one: '1 leto',
two: '2 leti',
three: '{{count}} leta',
other: '{{count}} let'
},
overXYears: {
one: 'več kot 1 leto',
two: 'več kot 2 leti',
three: 'več kot {{count}} leta',
other: 'več kot {{count}} let'
},
almostXYears: {
one: 'skoraj 1 leto',
two: 'skoraj 2 leti',
three: 'skoraj {{count}} leta',
other: 'skoraj {{count}} let'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else if (count === 2) {
result = distanceInWordsLocale[token].two
} else if (count === 3 || count === 4) {
result = distanceInWordsLocale[token].three.replace('{{count}}', count)
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
result = result.replace(/(minut|sekund|ur)(a)/, '$1o')
if (token === 'xMonths') {
result = result.replace(/(mesec)(i)/, '$1e')
}
if (options.comparison > 0) {
return 'čez ' + result
} else {
return result + ' nazaj'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 67 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'avg', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['januar', 'februar', 'marec', 'april', 'maj', 'junij', 'julij', 'avgust', 'september', 'oktober', 'november', 'december']
var weekdays2char = ['ne', 'po', 'to', 'sr', 'če', 'pe', 'so']
var weekdays3char = ['ned', 'pon', 'tor', 'sre', 'čet', 'pet', 'sob']
var weekdaysFull = ['nedelja', 'ponedeljek', 'torek', 'sreda', 'četrtek', 'petek', 'sobota']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['a.m.', 'p.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number + '.'
}
module.exports = buildFormatLocale
/***/ }),
/* 68 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
singular: 'mindre än en sekund',
plural: 'mindre än {{count}} sekunder'
},
xSeconds: {
singular: 'en sekund',
plural: '{{count}} sekunder'
},
halfAMinute: 'en halv minut',
lessThanXMinutes: {
singular: 'mindre än en minut',
plural: 'mindre än {{count}} minuter'
},
xMinutes: {
singular: 'en minut',
plural: '{{count}} minuter'
},
aboutXHours: {
singular: 'ungefär en timme',
plural: 'ungefär {{count}} timmar'
},
xHours: {
singular: 'en timme',
plural: '{{count}} timmar'
},
xDays: {
singular: 'en dag',
plural: '{{count}} dagar'
},
aboutXMonths: {
singular: 'ungefär en månad',
plural: 'ungefär {{count}} månader'
},
xMonths: {
singular: 'en månad',
plural: '{{count}} månader'
},
aboutXYears: {
singular: 'ungefär ett år',
plural: 'ungefär {{count}} år'
},
xYears: {
singular: 'ett år',
plural: '{{count}} år'
},
overXYears: {
singular: 'över ett år',
plural: 'över {{count}} år'
},
almostXYears: {
singular: 'nästan ett år',
plural: 'nästan {{count}} år'
}
}
var wordMapping = [
'noll',
'en',
'två',
'tre',
'fyra',
'fem',
'sex',
'sju',
'åtta',
'nio',
'tio',
'elva',
'tolv'
]
function localize (token, count, options) {
options = options || {}
var translation = distanceInWordsLocale[token]
var result
if (typeof translation === 'string') {
result = translation
} else if (count === 0 || count > 1) {
result = translation.plural.replace('{{count}}', count < 13 ? wordMapping[count] : count)
} else {
result = translation.singular
}
if (options.addSuffix) {
if (options.comparison > 0) {
return 'om ' + result
} else {
return result + ' sedan'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 69 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['jan', 'feb', 'mar', 'apr', 'maj', 'jun', 'jul', 'aug', 'sep', 'okt', 'nov', 'dec']
var monthsFull = ['januari', 'februari', 'mars', 'april', 'maj', 'juni', 'juli', 'augusti', 'september', 'oktober', 'november', 'december']
var weekdays2char = ['sö', 'må', 'ti', 'on', 'to', 'fr', 'lö']
var weekdays3char = ['sön', 'mån', 'tis', 'ons', 'tor', 'fre', 'lör']
var weekdaysFull = ['söndag', 'måndag', 'tisdag', 'onsdag', 'torsdag', 'fredag', 'lördag']
var meridiemFull = ['f.m.', 'e.m.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
formatters.A = formatters.aa
formatters.a = formatters.aa
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var rem100 = number % 100
if (rem100 > 20 || rem100 < 10) {
switch (rem100 % 10) {
case 1:
case 2:
return number + ':a'
}
}
return number + ':e'
}
module.exports = buildFormatLocale
/***/ }),
/* 70 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'น้อยกว่า 1 วินาที',
other: 'น้อยกว่า {{count}} วินาที'
},
xSeconds: {
one: '1 วินาที',
other: '{{count}} วินาที'
},
halfAMinute: 'ครึ่งนาที',
lessThanXMinutes: {
one: 'น้อยกว่า 1 นาที',
other: 'น้อยกว่า {{count}} นาที'
},
xMinutes: {
one: '1 นาที',
other: '{{count}} นาที'
},
aboutXHours: {
one: 'ประมาณ 1 ชั่วโมง',
other: 'ประมาณ {{count}} ชั่วโมง'
},
xHours: {
one: '1 ชั่วโมง',
other: '{{count}} ชั่วโมง'
},
xDays: {
one: '1 วัน',
other: '{{count}} วัน'
},
aboutXMonths: {
one: 'ประมาณ 1 เดือน',
other: 'ประมาณ {{count}} เดือน'
},
xMonths: {
one: '1 เดือน',
other: '{{count}} เดือน'
},
aboutXYears: {
one: 'ประมาณ 1 ปี',
other: 'ประมาณ {{count}} ปี'
},
xYears: {
one: '1 ปี',
other: '{{count}} ปี'
},
overXYears: {
one: 'มากกว่า 1 ปี',
other: 'มากกว่า {{count}} ปี'
},
almostXYears: {
one: 'เกือบ 1 ปี',
other: 'เกือบ {{count}} ปี'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
if (token === 'halfAMinute') {
return 'ใน' + result
} else {
return 'ใน ' + result
}
} else {
return result + 'ที่ผ่านมา'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 71 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['ม.ค.', 'ก.พ.', 'มี.ค.', 'เม.ย.', 'พ.ค.', 'มิ.ย.', 'ก.ค.', 'ส.ค.', 'ก.ย.', 'ต.ค.', 'พ.ย.', 'ธ.ค.']
var monthsFull = ['มกราคาม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม']
var weekdays2char = ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.']
var weekdays3char = ['อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.']
var weekdaysFull = ['อาทิตย์', 'จันทร์', 'อังคาร', 'พุธ', 'พฤหัสบดี', 'ศุกร์', 'เสาร์']
var meridiemUppercase = ['น.']
var meridiemLowercase = ['น.']
var meridiemFull = ['นาฬิกา']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return meridiemFull[0]
}
}
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
module.exports = buildFormatLocale
/***/ }),
/* 72 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: 'bir saniyeden az',
other: '{{count}} saniyeden az'
},
xSeconds: {
one: '1 saniye',
other: '{{count}} saniye'
},
halfAMinute: 'yarım dakika',
lessThanXMinutes: {
one: 'bir dakikadan az',
other: '{{count}} dakikadan az'
},
xMinutes: {
one: '1 dakika',
other: '{{count}} dakika'
},
aboutXHours: {
one: 'yaklaşık 1 saat',
other: 'yaklaşık {{count}} saat'
},
xHours: {
one: '1 saat',
other: '{{count}} saat'
},
xDays: {
one: '1 gün',
other: '{{count}} gün'
},
aboutXMonths: {
one: 'yaklaşık 1 ay',
other: 'yaklaşık {{count}} ay'
},
xMonths: {
one: '1 ay',
other: '{{count}} ay'
},
aboutXYears: {
one: 'yaklaşık 1 yıl',
other: 'yaklaşık {{count}} yıl'
},
xYears: {
one: '1 yıl',
other: '{{count}} yıl'
},
overXYears: {
one: '1 yıldan fazla',
other: '{{count}} yıldan fazla'
},
almostXYears: {
one: 'neredeyse 1 yıl',
other: 'neredeyse {{count}} yıl'
}
}
var extraWordTokens = [
'lessThanXSeconds',
'lessThanXMinutes',
'overXYears'
]
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
var extraWord = ''
if (extraWordTokens.indexOf(token) > -1) {
extraWord = ' bir süre'
}
if (options.comparison > 0) {
return result + extraWord + ' içinde'
} else {
return result + extraWord + ' önce'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 73 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
// Note: in Turkish, the names of days of the week and months are capitalized.
// If you are making a new locale based on this one, check if the same is true for the language you're working on.
// Generally, formatted dates should look like they are in the middle of a sentence,
// e.g. in Spanish language the weekdays and months should be in the lowercase.
var months3char = ['Oca', 'Şub', 'Mar', 'Nis', 'May', 'Haz', 'Tem', 'Ağu', 'Eyl', 'Eki', 'Kas', 'Ara']
var monthsFull = ['Ocak', 'Şubat', 'Mart', 'Nisan', 'Mayıs', 'Haziran', 'Temmuz', 'Ağustos', 'Eylül', 'Ekim', 'Kasım', 'Aralık']
var weekdays2char = ['Pz', 'Pt', 'Sa', 'Ça', 'Pe', 'Cu', 'Ct']
var weekdays3char = ['Paz', 'Pts', 'Sal', 'Çar', 'Per', 'Cum', 'Cts']
var weekdaysFull = ['Pazar', 'Pazartesi', 'Salı', 'Çarşamba', 'Perşembe', 'Cuma', 'Cumartesi']
var meridiemUppercase = ['ÖÖ', 'ÖS']
var meridiemLowercase = ['öö', 'ös']
var meridiemFull = ['ö.ö.', 'ö.s.']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
var suffixes = {
1: '\'inci',
2: '\'inci',
3: '\'üncü',
4: '\'üncü',
5: '\'inci',
6: '\'ıncı',
7: '\'inci',
8: '\'inci',
9: '\'uncu',
10: '\'uncu',
20: '\'inci',
30: '\'uncu',
50: '\'inci',
60: '\'ıncı',
70: '\'inci',
80: '\'inci',
90: '\'ıncı',
100: '\'üncü'
}
if (number === 0) {
return '0\'ıncı'
}
var x = number % 10
var y = number % 100 - x
var z = number >= 100 ? 100 : null
return number + (suffixes[x] || suffixes[y] || suffixes[z])
}
module.exports = buildFormatLocale
/***/ }),
/* 74 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '不到 1 秒',
other: '不到 {{count}} 秒'
},
xSeconds: {
one: '1 秒',
other: '{{count}} 秒'
},
halfAMinute: '半分钟',
lessThanXMinutes: {
one: '不到 1 分钟',
other: '不到 {{count}} 分钟'
},
xMinutes: {
one: '1 分钟',
other: '{{count}} 分钟'
},
xHours: {
one: '1 小时',
other: '{{count}} 小时'
},
aboutXHours: {
one: '大约 1 小时',
other: '大约 {{count}} 小时'
},
xDays: {
one: '1 天',
other: '{{count}} 天'
},
aboutXMonths: {
one: '大约 1 个月',
other: '大约 {{count}} 个月'
},
xMonths: {
one: '1 个月',
other: '{{count}} 个月'
},
aboutXYears: {
one: '大约 1 年',
other: '大约 {{count}} 年'
},
xYears: {
one: '1 年',
other: '{{count}} 年'
},
overXYears: {
one: '超过 1 年',
other: '超过 {{count}} 年'
},
almostXYears: {
one: '将近 1 年',
other: '将近 {{count}} 年'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + '内'
} else {
return result + '前'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 75 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
var monthsFull = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
var weekdays2char = ['日', '一', '二', '三', '四', '五', '六']
var weekdays3char = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
var weekdaysFull = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
var meridiemFull = ['上午', '下午']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
}
}
// AM, PM / am, pm / a.m., p.m. all translates to 上午, 下午
formatters.a = formatters.aa = formatters.A = function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number.toString()
}
module.exports = buildFormatLocale
/***/ }),
/* 76 */
/***/ (function(module, exports) {
function buildDistanceInWordsLocale () {
var distanceInWordsLocale = {
lessThanXSeconds: {
one: '少於 1 秒',
other: '少於 {{count}} 秒'
},
xSeconds: {
one: '1 秒',
other: '{{count}} 秒'
},
halfAMinute: '半分鐘',
lessThanXMinutes: {
one: '少於 1 分鐘',
other: '少於 {{count}} 分鐘'
},
xMinutes: {
one: '1 分鐘',
other: '{{count}} 分鐘'
},
xHours: {
one: '1 小時',
other: '{{count}} 小時'
},
aboutXHours: {
one: '大約 1 小時',
other: '大約 {{count}} 小時'
},
xDays: {
one: '1 天',
other: '{{count}} 天'
},
aboutXMonths: {
one: '大約 1 個月',
other: '大約 {{count}} 個月'
},
xMonths: {
one: '1 個月',
other: '{{count}} 個月'
},
aboutXYears: {
one: '大約 1 年',
other: '大約 {{count}} 年'
},
xYears: {
one: '1 年',
other: '{{count}} 年'
},
overXYears: {
one: '超過 1 年',
other: '超過 {{count}} 年'
},
almostXYears: {
one: '將近 1 年',
other: '將近 {{count}} 年'
}
}
function localize (token, count, options) {
options = options || {}
var result
if (typeof distanceInWordsLocale[token] === 'string') {
result = distanceInWordsLocale[token]
} else if (count === 1) {
result = distanceInWordsLocale[token].one
} else {
result = distanceInWordsLocale[token].other.replace('{{count}}', count)
}
if (options.addSuffix) {
if (options.comparison > 0) {
return result + '內'
} else {
return result + '前'
}
}
return result
}
return {
localize: localize
}
}
module.exports = buildDistanceInWordsLocale
/***/ }),
/* 77 */
/***/ (function(module, exports, __webpack_require__) {
var buildFormattingTokensRegExp = __webpack_require__(1)
function buildFormatLocale () {
var months3char = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
var monthsFull = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
var weekdays2char = ['日', '一', '二', '三', '四', '五', '六']
var weekdays3char = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']
var weekdaysFull = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
var meridiemUppercase = ['AM', 'PM']
var meridiemLowercase = ['am', 'pm']
var meridiemFull = ['上午', '下午']
var formatters = {
// Month: Jan, Feb, ..., Dec
'MMM': function (date) {
return months3char[date.getMonth()]
},
// Month: January, February, ..., December
'MMMM': function (date) {
return monthsFull[date.getMonth()]
},
// Day of week: Su, Mo, ..., Sa
'dd': function (date) {
return weekdays2char[date.getDay()]
},
// Day of week: Sun, Mon, ..., Sat
'ddd': function (date) {
return weekdays3char[date.getDay()]
},
// Day of week: Sunday, Monday, ..., Saturday
'dddd': function (date) {
return weekdaysFull[date.getDay()]
},
// AM, PM
'A': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemUppercase[1] : meridiemUppercase[0]
},
// am, pm
'a': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemLowercase[1] : meridiemLowercase[0]
},
// a.m., p.m.
'aa': function (date) {
return (date.getHours() / 12) >= 1 ? meridiemFull[1] : meridiemFull[0]
}
}
// Generate ordinal version of formatters: M -> Mo, D -> Do, etc.
var ordinalFormatters = ['M', 'D', 'DDD', 'd', 'Q', 'W']
ordinalFormatters.forEach(function (formatterToken) {
formatters[formatterToken + 'o'] = function (date, formatters) {
return ordinal(formatters[formatterToken](date))
}
})
return {
formatters: formatters,
formattingTokensRegExp: buildFormattingTokensRegExp(formatters)
}
}
function ordinal (number) {
return number.toString()
}
module.exports = buildFormatLocale
/***/ }),
/* 78 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Week Helpers
* @summary Return the start of a week for the given date.
*
* @description
* Return the start of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the start of a week
*
* @example
* // The start of a week for 2 September 2014 11:55:00:
* var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Aug 31 2014 00:00:00
*
* @example
* // If the week starts on Monday, the start of the week for 2 September 2014 11:55:00:
* var result = startOfWeek(new Date(2014, 8, 2, 11, 55, 0), {weekStartsOn: 1})
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfWeek (dirtyDate, dirtyOptions) {
var weekStartsOn = dirtyOptions ? (Number(dirtyOptions.weekStartsOn) || 0) : 0
var date = parse(dirtyDate)
var day = date.getDay()
var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn
date.setDate(date.getDate() - diff)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfWeek
/***/ }),
/* 79 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
var MILLISECONDS_IN_MINUTE = 60000
var MILLISECONDS_IN_DAY = 86400000
/**
* @category Day Helpers
* @summary Get the number of calendar days between the given dates.
*
* @description
* Get the number of calendar days between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar days
*
* @example
* // How many calendar days are between
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
* var result = differenceInCalendarDays(
* new Date(2012, 6, 2, 0, 0),
* new Date(2011, 6, 2, 23, 0)
* )
* //=> 366
*/
function differenceInCalendarDays (dirtyDateLeft, dirtyDateRight) {
var startOfDayLeft = startOfDay(dirtyDateLeft)
var startOfDayRight = startOfDay(dirtyDateRight)
var timestampLeft = startOfDayLeft.getTime() -
startOfDayLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
var timestampRight = startOfDayRight.getTime() -
startOfDayRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
// Round the number of days to the nearest integer
// because the number of milliseconds in a day is not constant
// (e.g. it's different in the day of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_DAY)
}
module.exports = differenceInCalendarDays
/***/ }),
/* 80 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var getDaysInMonth = __webpack_require__(116)
/**
* @category Month Helpers
* @summary Add the specified number of months to the given date.
*
* @description
* Add the specified number of months to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be added
* @returns {Date} the new date with the months added
*
* @example
* // Add 5 months to 1 September 2014:
* var result = addMonths(new Date(2014, 8, 1), 5)
* //=> Sun Feb 01 2015 00:00:00
*/
function addMonths (dirtyDate, dirtyAmount) {
var date = parse(dirtyDate)
var amount = Number(dirtyAmount)
var desiredMonth = date.getMonth() + amount
var dateWithDesiredMonth = new Date(0)
dateWithDesiredMonth.setFullYear(date.getFullYear(), desiredMonth, 1)
dateWithDesiredMonth.setHours(0, 0, 0, 0)
var daysInMonth = getDaysInMonth(dateWithDesiredMonth)
// Set the last day of the new month
// if the original date was the last day of the longer month
date.setMonth(desiredMonth, Math.min(daysInMonth, date.getDate()))
return date
}
module.exports = addMonths
/***/ }),
/* 81 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Millisecond Helpers
* @summary Get the number of milliseconds between the given dates.
*
* @description
* Get the number of milliseconds between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of milliseconds
*
* @example
* // How many milliseconds are between
* // 2 July 2014 12:30:20.600 and 2 July 2014 12:30:21.700?
* var result = differenceInMilliseconds(
* new Date(2014, 6, 2, 12, 30, 21, 700),
* new Date(2014, 6, 2, 12, 30, 20, 600)
* )
* //=> 1100
*/
function differenceInMilliseconds (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
return dateLeft.getTime() - dateRight.getTime()
}
module.exports = differenceInMilliseconds
/***/ }),
/* 82 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(12)
var buildFormatLocale = __webpack_require__(13)
/**
* @category Locales
* @summary Arabic locale (Modern Standard Arabic - Al-fussha).
* @author Abdallah Hassan [@AbdallahAHO]{@link https://github.com/AbdallahAHO}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 83 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(14)
var buildFormatLocale = __webpack_require__(15)
/**
* @category Locales
* @summary Bulgarian locale.
* @author Nikolay Stoynov [@arvigeus]{@link https://github.com/arvigeus}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 84 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(16)
var buildFormatLocale = __webpack_require__(17)
/**
* @category Locales
* @summary Catalan locale.
* @author Guillermo Grau [@guigrpa]{@link https://github.com/guigrpa}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 85 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(18)
var buildFormatLocale = __webpack_require__(19)
/**
* @category Locales
* @summary Czech locale.
* @author David Rus [@davidrus]{@link https://github.com/davidrus}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 86 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(20)
var buildFormatLocale = __webpack_require__(21)
/**
* @category Locales
* @summary Danish locale.
* @author Anders B. Hansen [@Andersbiha]{@link https://github.com/Andersbiha}
* @author [@kgram]{@link https://github.com/kgram}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 87 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(22)
var buildFormatLocale = __webpack_require__(23)
/**
* @category Locales
* @summary German locale.
* @author Thomas Eilmsteiner [@DeMuu]{@link https://github.com/DeMuu}
* @author Asia [@asia-t]{@link https://github.com/asia-t}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 88 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(24)
var buildFormatLocale = __webpack_require__(25)
/**
* @category Locales
* @summary Greek locale.
* @author Theodoros Orfanidis [@teoulas]{@link https://github.com/teoulas}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 89 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(26)
var buildFormatLocale = __webpack_require__(27)
/**
* @category Locales
* @summary Esperanto locale.
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 90 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(28)
var buildFormatLocale = __webpack_require__(29)
/**
* @category Locales
* @summary Spanish locale.
* @author Juan Angosto [@juanangosto]{@link https://github.com/juanangosto}
* @author Guillermo Grau [@guigrpa]{@link https://github.com/guigrpa}
* @author Fernando Agüero [@fjaguero]{@link https://github.com/fjaguero}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 91 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(30)
var buildFormatLocale = __webpack_require__(31)
/**
* @category Locales
* @summary Finnish locale.
* @author Pyry-Samuli Lahti [@Pyppe]{@link https://github.com/Pyppe}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 92 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(32)
var buildFormatLocale = __webpack_require__(33)
/**
* @category Locales
* @summary Filipino locale.
* @author Ian De La Cruz [@RIanDeLaCruz]{@link https://github.com/RIanDeLaCruz}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 93 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(34)
var buildFormatLocale = __webpack_require__(35)
/**
* @category Locales
* @summary French locale.
* @author Jean Dupouy [@izeau]{@link https://github.com/izeau}
* @author François B [@fbonzon]{@link https://github.com/fbonzon}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 94 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(36)
var buildFormatLocale = __webpack_require__(37)
/**
* @category Locales
* @summary Croatian locale.
* @author Matija Marohnić [@silvenon]{@link https://github.com/silvenon}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 95 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(38)
var buildFormatLocale = __webpack_require__(39)
/**
* @category Locales
* @summary English locale.
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 96 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(40)
var buildFormatLocale = __webpack_require__(41)
/**
* @category Locales
* @summary Indonesian locale.
* @author Rahmat Budiharso [@rbudiharso]{@link https://github.com/rbudiharso}
* @author Benget Nata [@bentinata]{@link https://github.com/bentinata}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 97 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(42)
var buildFormatLocale = __webpack_require__(43)
/**
* @category Locales
* @summary Icelandic locale.
* @author Derek Blank [@derekblank]{@link https://github.com/derekblank}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 98 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(44)
var buildFormatLocale = __webpack_require__(45)
/**
* @category Locales
* @summary Italian locale.
* @author Alberto Restifo [@albertorestifo]{@link https://github.com/albertorestifo}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 99 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(46)
var buildFormatLocale = __webpack_require__(47)
/**
* @category Locales
* @summary Japanese locale.
* @author Thomas Eilmsteiner [@DeMuu]{@link https://github.com/DeMuu}
* @author Yamagishi Kazutoshi [@ykzts]{@link https://github.com/ykzts}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 100 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(48)
var buildFormatLocale = __webpack_require__(49)
/**
* @category Locales
* @summary Korean locale.
* @author Hong Chulju [@angdev]{@link https://github.com/angdev}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 101 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(50)
var buildFormatLocale = __webpack_require__(51)
/**
* @category Locales
* @summary Macedonian locale.
* @author Petar Vlahu [@vlahupetar]{@link https://github.com/vlahupetar}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 102 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(52)
var buildFormatLocale = __webpack_require__(53)
/**
* @category Locales
* @summary Norwegian Bokmål locale.
* @author Hans-Kristian Koren [@Hanse]{@link https://github.com/Hanse}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 103 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(54)
var buildFormatLocale = __webpack_require__(55)
/**
* @category Locales
* @summary Dutch locale.
* @author Jorik Tangelder [@jtangelder]{@link https://github.com/jtangelder}
* @author Ruben Stolk [@rubenstolk]{@link https://github.com/rubenstolk}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 104 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(56)
var buildFormatLocale = __webpack_require__(57)
/**
* @category Locales
* @summary Polish locale.
* @author Mateusz Derks [@ertrzyiks]{@link https://github.com/ertrzyiks}
* @author Just RAG [@justrag]{@link https://github.com/justrag}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 105 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(58)
var buildFormatLocale = __webpack_require__(59)
/**
* @category Locales
* @summary Portuguese locale.
* @author Dário Freire [@dfreire]{@link https://github.com/dfreire}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 106 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(60)
var buildFormatLocale = __webpack_require__(61)
/**
* @category Locales
* @summary Romanian locale.
* @author Sergiu Munteanu [@jsergiu]{@link https://github.com/jsergiu}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 107 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(62)
var buildFormatLocale = __webpack_require__(63)
/**
* @category Locales
* @summary Russian locale.
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 108 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(64)
var buildFormatLocale = __webpack_require__(65)
/**
* @category Locales
* @summary Slovak locale.
* @author Marek Suscak [@mareksuscak]{@link https://github.com/mareksuscak}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 109 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(66)
var buildFormatLocale = __webpack_require__(67)
/**
* @category Locales
* @summary Slovenian locale.
* @author Adam Stradovnik [@Neoglyph]{@link https://github.com/Neoglyph}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 110 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(68)
var buildFormatLocale = __webpack_require__(69)
/**
* @category Locales
* @summary Swedish locale.
* @author Johannes Ulén [@ejulen]{@link https://github.com/ejulen}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 111 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(70)
var buildFormatLocale = __webpack_require__(71)
/**
* @category Locales
* @summary Thai locale.
* @author Athiwat Hirunworawongkun [@athivvat]{@link https://github.com/athivvat}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 112 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(72)
var buildFormatLocale = __webpack_require__(73)
/**
* @category Locales
* @summary Turkish locale.
* @author Alpcan Aydın [@alpcanaydin]{@link https://github.com/alpcanaydin}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 113 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(74)
var buildFormatLocale = __webpack_require__(75)
/**
* @category Locales
* @summary Chinese Simplified locale.
* @author Changyu Geng [@KingMario]{@link https://github.com/KingMario}
* @author Song Shuoyun [@fnlctrl]{@link https://github.com/fnlctrl}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 114 */
/***/ (function(module, exports, __webpack_require__) {
var buildDistanceInWordsLocale = __webpack_require__(76)
var buildFormatLocale = __webpack_require__(77)
/**
* @category Locales
* @summary Chinese Simplified locale.
* @author tonypai [@tpai]{@link https://github.com/tpai}
*/
module.exports = {
distanceInWords: buildDistanceInWordsLocale(),
format: buildFormatLocale()
}
/***/ }),
/* 115 */
/***/ (function(module, exports) {
/**
* @category Common Helpers
* @summary Is the given argument an instance of Date?
*
* @description
* Is the given argument an instance of Date?
*
* @param {*} argument - the argument to check
* @returns {Boolean} the given argument is an instance of Date
*
* @example
* // Is 'mayonnaise' a Date?
* var result = isDate('mayonnaise')
* //=> false
*/
function isDate (argument) {
return argument instanceof Date
}
module.exports = isDate
/***/ }),
/* 116 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Get the number of days in a month of the given date.
*
* @description
* Get the number of days in a month of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the number of days in a month
*
* @example
* // How many days are in February 2000?
* var result = getDaysInMonth(new Date(2000, 1))
* //=> 29
*/
function getDaysInMonth (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
var monthIndex = date.getMonth()
var lastDayOfMonth = new Date(0)
lastDayOfMonth.setFullYear(year, monthIndex + 1, 0)
lastDayOfMonth.setHours(0, 0, 0, 0)
return lastDayOfMonth.getDate()
}
module.exports = getDaysInMonth
/***/ }),
/* 117 */
/***/ (function(module, exports, __webpack_require__) {
var addDays = __webpack_require__(6)
/**
* @category Week Helpers
* @summary Add the specified number of weeks to the given date.
*
* @description
* Add the specified number of week to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be added
* @returns {Date} the new date with the weeks added
*
* @example
* // Add 4 weeks to 1 September 2014:
* var result = addWeeks(new Date(2014, 8, 1), 4)
* //=> Mon Sep 29 2014 00:00:00
*/
function addWeeks (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
var days = amount * 7
return addDays(dirtyDate, days)
}
module.exports = addWeeks
/***/ }),
/* 118 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Compare the two dates reverse chronologically and return -1, 0 or 1.
*
* @description
* Compare the two dates and return -1 if the first date is after the second,
* 1 if the first date is before the second or 0 if dates are equal.
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Number} the result of the comparison
*
* @example
* // Compare 11 February 1987 and 10 July 1989 reverse chronologically:
* var result = compareDesc(
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* )
* //=> 1
*
* @example
* // Sort the array of dates in reverse chronological order:
* var result = [
* new Date(1995, 6, 2),
* new Date(1987, 1, 11),
* new Date(1989, 6, 10)
* ].sort(compareDesc)
* //=> [
* // Sun Jul 02 1995 00:00:00,
* // Mon Jul 10 1989 00:00:00,
* // Wed Feb 11 1987 00:00:00
* // ]
*/
function compareDesc (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var timeLeft = dateLeft.getTime()
var dateRight = parse(dirtyDateRight)
var timeRight = dateRight.getTime()
if (timeLeft > timeRight) {
return -1
} else if (timeLeft < timeRight) {
return 1
} else {
return 0
}
}
module.exports = compareDesc
/***/ }),
/* 119 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var differenceInCalendarMonths = __webpack_require__(133)
var compareAsc = __webpack_require__(9)
/**
* @category Month Helpers
* @summary Get the number of full months between the given dates.
*
* @description
* Get the number of full months between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full months
*
* @example
* // How many full months are between 31 January 2014 and 1 September 2014?
* var result = differenceInMonths(
* new Date(2014, 8, 1),
* new Date(2014, 0, 31)
* )
* //=> 7
*/
function differenceInMonths (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var sign = compareAsc(dateLeft, dateRight)
var difference = Math.abs(differenceInCalendarMonths(dateLeft, dateRight))
dateLeft.setMonth(dateLeft.getMonth() - sign * difference)
// Math.abs(diff in full months - diff in calendar months) === 1 if last calendar month is not full
// If so, result must be decreased by 1 in absolute value
var isLastMonthNotFull = compareAsc(dateLeft, dateRight) === -sign
return sign * (difference - isLastMonthNotFull)
}
module.exports = differenceInMonths
/***/ }),
/* 120 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInMilliseconds = __webpack_require__(81)
/**
* @category Second Helpers
* @summary Get the number of seconds between the given dates.
*
* @description
* Get the number of seconds between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of seconds
*
* @example
* // How many seconds are between
* // 2 July 2014 12:30:07.999 and 2 July 2014 12:30:20.000?
* var result = differenceInSeconds(
* new Date(2014, 6, 2, 12, 30, 20, 0),
* new Date(2014, 6, 2, 12, 30, 7, 999)
* )
* //=> 12
*/
function differenceInSeconds (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / 1000
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInSeconds
/***/ }),
/* 121 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Return the end of a day for the given date.
*
* @description
* Return the end of a day for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a day
*
* @example
* // The end of a day for 2 September 2014 11:55:00:
* var result = endOfDay(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 02 2014 23:59:59.999
*/
function endOfDay (dirtyDate) {
var date = parse(dirtyDate)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfDay
/***/ }),
/* 122 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var startOfISOWeek = __webpack_require__(3)
var startOfISOYear = __webpack_require__(8)
var MILLISECONDS_IN_WEEK = 604800000
/**
* @category ISO Week Helpers
* @summary Get the ISO week of the given date.
*
* @description
* Get the ISO week of the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the ISO week
*
* @example
* // Which week of the ISO-week numbering year is 2 January 2005?
* var result = getISOWeek(new Date(2005, 0, 2))
* //=> 53
*/
function getISOWeek (dirtyDate) {
var date = parse(dirtyDate)
var diff = startOfISOWeek(date).getTime() - startOfISOYear(date).getTime()
// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / MILLISECONDS_IN_WEEK) + 1
}
module.exports = getISOWeek
/***/ }),
/* 123 */
/***/ (function(module, exports, __webpack_require__) {
var startOfWeek = __webpack_require__(78)
/**
* @category Week Helpers
* @summary Are the given dates in the same week?
*
* @description
* Are the given dates in the same week?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Boolean} the dates are in the same week
*
* @example
* // Are 31 August 2014 and 4 September 2014 in the same week?
* var result = isSameWeek(
* new Date(2014, 7, 31),
* new Date(2014, 8, 4)
* )
* //=> true
*
* @example
* // If week starts with Monday,
* // are 31 August 2014 and 4 September 2014 in the same week?
* var result = isSameWeek(
* new Date(2014, 7, 31),
* new Date(2014, 8, 4),
* {weekStartsOn: 1}
* )
* //=> false
*/
function isSameWeek (dirtyDateLeft, dirtyDateRight, dirtyOptions) {
var dateLeftStartOfWeek = startOfWeek(dirtyDateLeft, dirtyOptions)
var dateRightStartOfWeek = startOfWeek(dirtyDateRight, dirtyOptions)
return dateLeftStartOfWeek.getTime() === dateRightStartOfWeek.getTime()
}
module.exports = isSameWeek
/***/ }),
/* 124 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = {
addDays: __webpack_require__(6),
addHours: __webpack_require__(125),
addISOYears: __webpack_require__(126),
addMilliseconds: __webpack_require__(7),
addMinutes: __webpack_require__(128),
addMonths: __webpack_require__(80),
addQuarters: __webpack_require__(129),
addSeconds: __webpack_require__(130),
addWeeks: __webpack_require__(117),
addYears: __webpack_require__(131),
areRangesOverlapping: __webpack_require__(202),
closestIndexTo: __webpack_require__(203),
closestTo: __webpack_require__(204),
compareAsc: __webpack_require__(9),
compareDesc: __webpack_require__(118),
differenceInCalendarDays: __webpack_require__(79),
differenceInCalendarISOWeeks: __webpack_require__(205),
differenceInCalendarISOYears: __webpack_require__(132),
differenceInCalendarMonths: __webpack_require__(133),
differenceInCalendarQuarters: __webpack_require__(206),
differenceInCalendarWeeks: __webpack_require__(207),
differenceInCalendarYears: __webpack_require__(135),
differenceInDays: __webpack_require__(136),
differenceInHours: __webpack_require__(208),
differenceInISOYears: __webpack_require__(209),
differenceInMilliseconds: __webpack_require__(81),
differenceInMinutes: __webpack_require__(210),
differenceInMonths: __webpack_require__(119),
differenceInQuarters: __webpack_require__(211),
differenceInSeconds: __webpack_require__(120),
differenceInWeeks: __webpack_require__(212),
differenceInYears: __webpack_require__(213),
distanceInWords: __webpack_require__(138),
distanceInWordsStrict: __webpack_require__(214),
distanceInWordsToNow: __webpack_require__(215),
eachDay: __webpack_require__(216),
endOfDay: __webpack_require__(121),
endOfHour: __webpack_require__(217),
endOfISOWeek: __webpack_require__(218),
endOfISOYear: __webpack_require__(219),
endOfMinute: __webpack_require__(220),
endOfMonth: __webpack_require__(140),
endOfQuarter: __webpack_require__(221),
endOfSecond: __webpack_require__(222),
endOfToday: __webpack_require__(223),
endOfTomorrow: __webpack_require__(224),
endOfWeek: __webpack_require__(139),
endOfYear: __webpack_require__(225),
endOfYesterday: __webpack_require__(226),
format: __webpack_require__(227),
getDate: __webpack_require__(228),
getDay: __webpack_require__(229),
getDayOfYear: __webpack_require__(141),
getDaysInMonth: __webpack_require__(116),
getDaysInYear: __webpack_require__(230),
getHours: __webpack_require__(231),
getISODay: __webpack_require__(145),
getISOWeek: __webpack_require__(122),
getISOWeeksInYear: __webpack_require__(232),
getISOYear: __webpack_require__(2),
getMilliseconds: __webpack_require__(233),
getMinutes: __webpack_require__(234),
getMonth: __webpack_require__(235),
getOverlappingDaysInRanges: __webpack_require__(236),
getQuarter: __webpack_require__(134),
getSeconds: __webpack_require__(237),
getTime: __webpack_require__(238),
getYear: __webpack_require__(239),
isAfter: __webpack_require__(240),
isBefore: __webpack_require__(241),
isDate: __webpack_require__(115),
isEqual: __webpack_require__(242),
isFirstDayOfMonth: __webpack_require__(243),
isFriday: __webpack_require__(244),
isFuture: __webpack_require__(245),
isLastDayOfMonth: __webpack_require__(246),
isLeapYear: __webpack_require__(144),
isMonday: __webpack_require__(247),
isPast: __webpack_require__(248),
isSameDay: __webpack_require__(249),
isSameHour: __webpack_require__(146),
isSameISOWeek: __webpack_require__(148),
isSameISOYear: __webpack_require__(149),
isSameMinute: __webpack_require__(150),
isSameMonth: __webpack_require__(152),
isSameQuarter: __webpack_require__(153),
isSameSecond: __webpack_require__(155),
isSameWeek: __webpack_require__(123),
isSameYear: __webpack_require__(157),
isSaturday: __webpack_require__(250),
isSunday: __webpack_require__(251),
isThisHour: __webpack_require__(252),
isThisISOWeek: __webpack_require__(253),
isThisISOYear: __webpack_require__(254),
isThisMinute: __webpack_require__(255),
isThisMonth: __webpack_require__(256),
isThisQuarter: __webpack_require__(257),
isThisSecond: __webpack_require__(258),
isThisWeek: __webpack_require__(259),
isThisYear: __webpack_require__(260),
isThursday: __webpack_require__(261),
isToday: __webpack_require__(262),
isTomorrow: __webpack_require__(263),
isTuesday: __webpack_require__(264),
isValid: __webpack_require__(143),
isWednesday: __webpack_require__(265),
isWeekend: __webpack_require__(266),
isWithinRange: __webpack_require__(267),
isYesterday: __webpack_require__(268),
lastDayOfISOWeek: __webpack_require__(269),
lastDayOfISOYear: __webpack_require__(270),
lastDayOfMonth: __webpack_require__(271),
lastDayOfQuarter: __webpack_require__(272),
lastDayOfWeek: __webpack_require__(158),
lastDayOfYear: __webpack_require__(273),
max: __webpack_require__(274),
min: __webpack_require__(275),
parse: __webpack_require__(0),
setDate: __webpack_require__(276),
setDay: __webpack_require__(277),
setDayOfYear: __webpack_require__(278),
setHours: __webpack_require__(279),
setISODay: __webpack_require__(280),
setISOWeek: __webpack_require__(281),
setISOYear: __webpack_require__(127),
setMilliseconds: __webpack_require__(282),
setMinutes: __webpack_require__(283),
setMonth: __webpack_require__(159),
setQuarter: __webpack_require__(284),
setSeconds: __webpack_require__(285),
setYear: __webpack_require__(286),
startOfDay: __webpack_require__(4),
startOfHour: __webpack_require__(147),
startOfISOWeek: __webpack_require__(3),
startOfISOYear: __webpack_require__(8),
startOfMinute: __webpack_require__(151),
startOfMonth: __webpack_require__(287),
startOfQuarter: __webpack_require__(154),
startOfSecond: __webpack_require__(156),
startOfToday: __webpack_require__(288),
startOfTomorrow: __webpack_require__(289),
startOfWeek: __webpack_require__(78),
startOfYear: __webpack_require__(142),
startOfYesterday: __webpack_require__(290),
subDays: __webpack_require__(291),
subHours: __webpack_require__(292),
subISOYears: __webpack_require__(137),
subMilliseconds: __webpack_require__(293),
subMinutes: __webpack_require__(294),
subMonths: __webpack_require__(295),
subQuarters: __webpack_require__(296),
subSeconds: __webpack_require__(297),
subWeeks: __webpack_require__(298),
subYears: __webpack_require__(299)
}
/***/ }),
/* 125 */
/***/ (function(module, exports, __webpack_require__) {
var addMilliseconds = __webpack_require__(7)
var MILLISECONDS_IN_HOUR = 3600000
/**
* @category Hour Helpers
* @summary Add the specified number of hours to the given date.
*
* @description
* Add the specified number of hours to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of hours to be added
* @returns {Date} the new date with the hours added
*
* @example
* // Add 2 hours to 10 July 2014 23:00:00:
* var result = addHours(new Date(2014, 6, 10, 23, 0), 2)
* //=> Fri Jul 11 2014 01:00:00
*/
function addHours (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR)
}
module.exports = addHours
/***/ }),
/* 126 */
/***/ (function(module, exports, __webpack_require__) {
var getISOYear = __webpack_require__(2)
var setISOYear = __webpack_require__(127)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Add the specified number of ISO week-numbering years to the given date.
*
* @description
* Add the specified number of ISO week-numbering years to the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of ISO week-numbering years to be added
* @returns {Date} the new date with the ISO week-numbering years added
*
* @example
* // Add 5 ISO week-numbering years to 2 July 2010:
* var result = addISOYears(new Date(2010, 6, 2), 5)
* //=> Fri Jun 26 2015 00:00:00
*/
function addISOYears (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return setISOYear(dirtyDate, getISOYear(dirtyDate) + amount)
}
module.exports = addISOYears
/***/ }),
/* 127 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var startOfISOYear = __webpack_require__(8)
var differenceInCalendarDays = __webpack_require__(79)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Set the ISO week-numbering year to the given date.
*
* @description
* Set the ISO week-numbering year to the given date,
* saving the week number and the weekday number.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} isoYear - the ISO week-numbering year of the new date
* @returns {Date} the new date with the ISO week-numbering year setted
*
* @example
* // Set ISO week-numbering year 2007 to 29 December 2008:
* var result = setISOYear(new Date(2008, 11, 29), 2007)
* //=> Mon Jan 01 2007 00:00:00
*/
function setISOYear (dirtyDate, dirtyISOYear) {
var date = parse(dirtyDate)
var isoYear = Number(dirtyISOYear)
var diff = differenceInCalendarDays(date, startOfISOYear(date))
var fourthOfJanuary = new Date(0)
fourthOfJanuary.setFullYear(isoYear, 0, 4)
fourthOfJanuary.setHours(0, 0, 0, 0)
date = startOfISOYear(fourthOfJanuary)
date.setDate(date.getDate() + diff)
return date
}
module.exports = setISOYear
/***/ }),
/* 128 */
/***/ (function(module, exports, __webpack_require__) {
var addMilliseconds = __webpack_require__(7)
var MILLISECONDS_IN_MINUTE = 60000
/**
* @category Minute Helpers
* @summary Add the specified number of minutes to the given date.
*
* @description
* Add the specified number of minutes to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of minutes to be added
* @returns {Date} the new date with the minutes added
*
* @example
* // Add 30 minutes to 10 July 2014 12:00:00:
* var result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)
* //=> Thu Jul 10 2014 12:30:00
*/
function addMinutes (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE)
}
module.exports = addMinutes
/***/ }),
/* 129 */
/***/ (function(module, exports, __webpack_require__) {
var addMonths = __webpack_require__(80)
/**
* @category Quarter Helpers
* @summary Add the specified number of year quarters to the given date.
*
* @description
* Add the specified number of year quarters to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of quarters to be added
* @returns {Date} the new date with the quarters added
*
* @example
* // Add 1 quarter to 1 September 2014:
* var result = addQuarters(new Date(2014, 8, 1), 1)
* //=> Mon Dec 01 2014 00:00:00
*/
function addQuarters (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
var months = amount * 3
return addMonths(dirtyDate, months)
}
module.exports = addQuarters
/***/ }),
/* 130 */
/***/ (function(module, exports, __webpack_require__) {
var addMilliseconds = __webpack_require__(7)
/**
* @category Second Helpers
* @summary Add the specified number of seconds to the given date.
*
* @description
* Add the specified number of seconds to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be added
* @returns {Date} the new date with the seconds added
*
* @example
* // Add 30 seconds to 10 July 2014 12:45:00:
* var result = addSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)
* //=> Thu Jul 10 2014 12:45:30
*/
function addSeconds (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMilliseconds(dirtyDate, amount * 1000)
}
module.exports = addSeconds
/***/ }),
/* 131 */
/***/ (function(module, exports, __webpack_require__) {
var addMonths = __webpack_require__(80)
/**
* @category Year Helpers
* @summary Add the specified number of years to the given date.
*
* @description
* Add the specified number of years to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be added
* @returns {Date} the new date with the years added
*
* @example
* // Add 5 years to 1 September 2014:
* var result = addYears(new Date(2014, 8, 1), 5)
* //=> Sun Sep 01 2019 00:00:00
*/
function addYears (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMonths(dirtyDate, amount * 12)
}
module.exports = addYears
/***/ }),
/* 132 */
/***/ (function(module, exports, __webpack_require__) {
var getISOYear = __webpack_require__(2)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Get the number of calendar ISO week-numbering years between the given dates.
*
* @description
* Get the number of calendar ISO week-numbering years between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar ISO week-numbering years
*
* @example
* // How many calendar ISO week-numbering years are 1 January 2010 and 1 January 2012?
* var result = differenceInCalendarISOYears(
* new Date(2012, 0, 1),
* new Date(2010, 0, 1)
* )
* //=> 2
*/
function differenceInCalendarISOYears (dirtyDateLeft, dirtyDateRight) {
return getISOYear(dirtyDateLeft) - getISOYear(dirtyDateRight)
}
module.exports = differenceInCalendarISOYears
/***/ }),
/* 133 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Get the number of calendar months between the given dates.
*
* @description
* Get the number of calendar months between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar months
*
* @example
* // How many calendar months are between 31 January 2014 and 1 September 2014?
* var result = differenceInCalendarMonths(
* new Date(2014, 8, 1),
* new Date(2014, 0, 31)
* )
* //=> 8
*/
function differenceInCalendarMonths (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear()
var monthDiff = dateLeft.getMonth() - dateRight.getMonth()
return yearDiff * 12 + monthDiff
}
module.exports = differenceInCalendarMonths
/***/ }),
/* 134 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Quarter Helpers
* @summary Get the year quarter of the given date.
*
* @description
* Get the year quarter of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the quarter
*
* @example
* // Which quarter is 2 July 2014?
* var result = getQuarter(new Date(2014, 6, 2))
* //=> 3
*/
function getQuarter (dirtyDate) {
var date = parse(dirtyDate)
var quarter = Math.floor(date.getMonth() / 3) + 1
return quarter
}
module.exports = getQuarter
/***/ }),
/* 135 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Get the number of calendar years between the given dates.
*
* @description
* Get the number of calendar years between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar years
*
* @example
* // How many calendar years are between 31 December 2013 and 11 February 2015?
* var result = differenceInCalendarYears(
* new Date(2015, 1, 11),
* new Date(2013, 11, 31)
* )
* //=> 2
*/
function differenceInCalendarYears (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
return dateLeft.getFullYear() - dateRight.getFullYear()
}
module.exports = differenceInCalendarYears
/***/ }),
/* 136 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var differenceInCalendarDays = __webpack_require__(79)
var compareAsc = __webpack_require__(9)
/**
* @category Day Helpers
* @summary Get the number of full days between the given dates.
*
* @description
* Get the number of full days between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full days
*
* @example
* // How many full days are between
* // 2 July 2011 23:00:00 and 2 July 2012 00:00:00?
* var result = differenceInDays(
* new Date(2012, 6, 2, 0, 0),
* new Date(2011, 6, 2, 23, 0)
* )
* //=> 365
*/
function differenceInDays (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var sign = compareAsc(dateLeft, dateRight)
var difference = Math.abs(differenceInCalendarDays(dateLeft, dateRight))
dateLeft.setDate(dateLeft.getDate() - sign * difference)
// Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full
// If so, result must be decreased by 1 in absolute value
var isLastDayNotFull = compareAsc(dateLeft, dateRight) === -sign
return sign * (difference - isLastDayNotFull)
}
module.exports = differenceInDays
/***/ }),
/* 137 */
/***/ (function(module, exports, __webpack_require__) {
var addISOYears = __webpack_require__(126)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Subtract the specified number of ISO week-numbering years from the given date.
*
* @description
* Subtract the specified number of ISO week-numbering years from the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of ISO week-numbering years to be subtracted
* @returns {Date} the new date with the ISO week-numbering years subtracted
*
* @example
* // Subtract 5 ISO week-numbering years from 1 September 2014:
* var result = subISOYears(new Date(2014, 8, 1), 5)
* //=> Mon Aug 31 2009 00:00:00
*/
function subISOYears (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addISOYears(dirtyDate, -amount)
}
module.exports = subISOYears
/***/ }),
/* 138 */
/***/ (function(module, exports, __webpack_require__) {
var compareDesc = __webpack_require__(118)
var parse = __webpack_require__(0)
var differenceInSeconds = __webpack_require__(120)
var differenceInMonths = __webpack_require__(119)
var enLocale = __webpack_require__(5)
var MINUTES_IN_DAY = 1440
var MINUTES_IN_ALMOST_TWO_DAYS = 2520
var MINUTES_IN_MONTH = 43200
var MINUTES_IN_TWO_MONTHS = 86400
/**
* @category Common Helpers
* @summary Return the distance between the given dates in words.
*
* @description
* Return the distance between the given dates in words.
*
* | Distance between dates | Result |
* |-------------------------------------------------------------------|---------------------|
* | 0 ... 30 secs | less than a minute |
* | 30 secs ... 1 min 30 secs | 1 minute |
* | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
* | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
* | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
* | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
* | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
* | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
* | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
* | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
* | 1 yr ... 1 yr 3 months | about 1 year |
* | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
* | 1 yr 9 months ... 2 yrs | almost 2 years |
* | N yrs ... N yrs 3 months | about N years |
* | N yrs 3 months ... N yrs 9 months | over N years |
* | N yrs 9 months ... N+1 yrs | almost N+1 years |
*
* With `options.includeSeconds == true`:
* | Distance between dates | Result |
* |------------------------|----------------------|
* | 0 secs ... 5 secs | less than 5 seconds |
* | 5 secs ... 10 secs | less than 10 seconds |
* | 10 secs ... 20 secs | less than 20 seconds |
* | 20 secs ... 40 secs | half a minute |
* | 40 secs ... 60 secs | less than a minute |
* | 60 secs ... 90 secs | 1 minute |
*
* @param {Date|String|Number} dateToCompare - the date to compare with
* @param {Date|String|Number} date - the other date
* @param {Object} [options] - the object with options
* @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the distance in words
*
* @example
* // What is the distance between 2 July 2014 and 1 January 2015?
* var result = distanceInWords(
* new Date(2014, 6, 2),
* new Date(2015, 0, 1)
* )
* //=> '6 months'
*
* @example
* // What is the distance between 1 January 2015 00:00:15
* // and 1 January 2015 00:00:00, including seconds?
* var result = distanceInWords(
* new Date(2015, 0, 1, 0, 0, 15),
* new Date(2015, 0, 1, 0, 0, 0),
* {includeSeconds: true}
* )
* //=> 'less than 20 seconds'
*
* @example
* // What is the distance from 1 January 2016
* // to 1 January 2015, with a suffix?
* var result = distanceInWords(
* new Date(2016, 0, 1),
* new Date(2015, 0, 1),
* {addSuffix: true}
* )
* //=> 'about 1 year ago'
*
* @example
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
* var eoLocale = require('date-fns/locale/eo')
* var result = distanceInWords(
* new Date(2016, 7, 1),
* new Date(2015, 0, 1),
* {locale: eoLocale}
* )
* //=> 'pli ol 1 jaro'
*/
function distanceInWords (dirtyDateToCompare, dirtyDate, dirtyOptions) {
var options = dirtyOptions || {}
var comparison = compareDesc(dirtyDateToCompare, dirtyDate)
var locale = options.locale
var localize = enLocale.distanceInWords.localize
if (locale && locale.distanceInWords && locale.distanceInWords.localize) {
localize = locale.distanceInWords.localize
}
var localizeOptions = {
addSuffix: Boolean(options.addSuffix),
comparison: comparison
}
var dateLeft, dateRight
if (comparison > 0) {
dateLeft = parse(dirtyDateToCompare)
dateRight = parse(dirtyDate)
} else {
dateLeft = parse(dirtyDate)
dateRight = parse(dirtyDateToCompare)
}
var seconds = differenceInSeconds(dateRight, dateLeft)
var offset = dateRight.getTimezoneOffset() - dateLeft.getTimezoneOffset()
var minutes = Math.round(seconds / 60) - offset
var months
// 0 up to 2 mins
if (minutes < 2) {
if (options.includeSeconds) {
if (seconds < 5) {
return localize('lessThanXSeconds', 5, localizeOptions)
} else if (seconds < 10) {
return localize('lessThanXSeconds', 10, localizeOptions)
} else if (seconds < 20) {
return localize('lessThanXSeconds', 20, localizeOptions)
} else if (seconds < 40) {
return localize('halfAMinute', null, localizeOptions)
} else if (seconds < 60) {
return localize('lessThanXMinutes', 1, localizeOptions)
} else {
return localize('xMinutes', 1, localizeOptions)
}
} else {
if (minutes === 0) {
return localize('lessThanXMinutes', 1, localizeOptions)
} else {
return localize('xMinutes', minutes, localizeOptions)
}
}
// 2 mins up to 0.75 hrs
} else if (minutes < 45) {
return localize('xMinutes', minutes, localizeOptions)
// 0.75 hrs up to 1.5 hrs
} else if (minutes < 90) {
return localize('aboutXHours', 1, localizeOptions)
// 1.5 hrs up to 24 hrs
} else if (minutes < MINUTES_IN_DAY) {
var hours = Math.round(minutes / 60)
return localize('aboutXHours', hours, localizeOptions)
// 1 day up to 1.75 days
} else if (minutes < MINUTES_IN_ALMOST_TWO_DAYS) {
return localize('xDays', 1, localizeOptions)
// 1.75 days up to 30 days
} else if (minutes < MINUTES_IN_MONTH) {
var days = Math.round(minutes / MINUTES_IN_DAY)
return localize('xDays', days, localizeOptions)
// 1 month up to 2 months
} else if (minutes < MINUTES_IN_TWO_MONTHS) {
months = Math.round(minutes / MINUTES_IN_MONTH)
return localize('aboutXMonths', months, localizeOptions)
}
months = differenceInMonths(dateRight, dateLeft)
// 2 months up to 12 months
if (months < 12) {
var nearestMonth = Math.round(minutes / MINUTES_IN_MONTH)
return localize('xMonths', nearestMonth, localizeOptions)
// 1 year up to max Date
} else {
var monthsSinceStartOfYear = months % 12
var years = Math.floor(months / 12)
// N years up to 1 years 3 months
if (monthsSinceStartOfYear < 3) {
return localize('aboutXYears', years, localizeOptions)
// N years 3 months up to N years 9 months
} else if (monthsSinceStartOfYear < 9) {
return localize('overXYears', years, localizeOptions)
// N years 9 months up to N year 12 months
} else {
return localize('almostXYears', years + 1, localizeOptions)
}
}
}
module.exports = distanceInWords
/***/ }),
/* 139 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Week Helpers
* @summary Return the end of a week for the given date.
*
* @description
* Return the end of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the end of a week
*
* @example
* // The end of a week for 2 September 2014 11:55:00:
* var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sat Sep 06 2014 23:59:59.999
*
* @example
* // If the week starts on Monday, the end of the week for 2 September 2014 11:55:00:
* var result = endOfWeek(new Date(2014, 8, 2, 11, 55, 0), {weekStartsOn: 1})
* //=> Sun Sep 07 2014 23:59:59.999
*/
function endOfWeek (dirtyDate, dirtyOptions) {
var weekStartsOn = dirtyOptions ? (Number(dirtyOptions.weekStartsOn) || 0) : 0
var date = parse(dirtyDate)
var day = date.getDay()
var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn)
date.setDate(date.getDate() + diff)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfWeek
/***/ }),
/* 140 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Return the end of a month for the given date.
*
* @description
* Return the end of a month for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a month
*
* @example
* // The end of a month for 2 September 2014 11:55:00:
* var result = endOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 23:59:59.999
*/
function endOfMonth (dirtyDate) {
var date = parse(dirtyDate)
var month = date.getMonth()
date.setFullYear(date.getFullYear(), month + 1, 0)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfMonth
/***/ }),
/* 141 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var startOfYear = __webpack_require__(142)
var differenceInCalendarDays = __webpack_require__(79)
/**
* @category Day Helpers
* @summary Get the day of the year of the given date.
*
* @description
* Get the day of the year of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the day of year
*
* @example
* // Which day of the year is 2 July 2014?
* var result = getDayOfYear(new Date(2014, 6, 2))
* //=> 183
*/
function getDayOfYear (dirtyDate) {
var date = parse(dirtyDate)
var diff = differenceInCalendarDays(date, startOfYear(date))
var dayOfYear = diff + 1
return dayOfYear
}
module.exports = getDayOfYear
/***/ }),
/* 142 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Return the start of a year for the given date.
*
* @description
* Return the start of a year for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a year
*
* @example
* // The start of a year for 2 September 2014 11:55:00:
* var result = startOfYear(new Date(2014, 8, 2, 11, 55, 00))
* //=> Wed Jan 01 2014 00:00:00
*/
function startOfYear (dirtyDate) {
var cleanDate = parse(dirtyDate)
var date = new Date(0)
date.setFullYear(cleanDate.getFullYear(), 0, 1)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfYear
/***/ }),
/* 143 */
/***/ (function(module, exports, __webpack_require__) {
var isDate = __webpack_require__(115)
/**
* @category Common Helpers
* @summary Is the given date valid?
*
* @description
* Returns false if argument is Invalid Date and true otherwise.
* Invalid Date is a Date, whose time value is NaN.
*
* Time value of Date: http://es5.github.io/#x15.9.1.1
*
* @param {Date} date - the date to check
* @returns {Boolean} the date is valid
* @throws {TypeError} argument must be an instance of Date
*
* @example
* // For the valid date:
* var result = isValid(new Date(2014, 1, 31))
* //=> true
*
* @example
* // For the invalid date:
* var result = isValid(new Date(''))
* //=> false
*/
function isValid (dirtyDate) {
if (isDate(dirtyDate)) {
return !isNaN(dirtyDate)
} else {
throw new TypeError(toString.call(dirtyDate) + ' is not an instance of Date')
}
}
module.exports = isValid
/***/ }),
/* 144 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Is the given date in the leap year?
*
* @description
* Is the given date in the leap year?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in the leap year
*
* @example
* // Is 1 September 2012 in the leap year?
* var result = isLeapYear(new Date(2012, 8, 1))
* //=> true
*/
function isLeapYear (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0
}
module.exports = isLeapYear
/***/ }),
/* 145 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Get the day of the ISO week of the given date.
*
* @description
* Get the day of the ISO week of the given date,
* which is 7 for Sunday, 1 for Monday etc.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the day of ISO week
*
* @example
* // Which day of the ISO week is 26 February 2012?
* var result = getISODay(new Date(2012, 1, 26))
* //=> 7
*/
function getISODay (dirtyDate) {
var date = parse(dirtyDate)
var day = date.getDay()
if (day === 0) {
day = 7
}
return day
}
module.exports = getISODay
/***/ }),
/* 146 */
/***/ (function(module, exports, __webpack_require__) {
var startOfHour = __webpack_require__(147)
/**
* @category Hour Helpers
* @summary Are the given dates in the same hour?
*
* @description
* Are the given dates in the same hour?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same hour
*
* @example
* // Are 4 September 2014 06:00:00 and 4 September 06:30:00 in the same hour?
* var result = isSameHour(
* new Date(2014, 8, 4, 6, 0),
* new Date(2014, 8, 4, 6, 30)
* )
* //=> true
*/
function isSameHour (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfHour = startOfHour(dirtyDateLeft)
var dateRightStartOfHour = startOfHour(dirtyDateRight)
return dateLeftStartOfHour.getTime() === dateRightStartOfHour.getTime()
}
module.exports = isSameHour
/***/ }),
/* 147 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Hour Helpers
* @summary Return the start of an hour for the given date.
*
* @description
* Return the start of an hour for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of an hour
*
* @example
* // The start of an hour for 2 September 2014 11:55:00:
* var result = startOfHour(new Date(2014, 8, 2, 11, 55))
* //=> Tue Sep 02 2014 11:00:00
*/
function startOfHour (dirtyDate) {
var date = parse(dirtyDate)
date.setMinutes(0, 0, 0)
return date
}
module.exports = startOfHour
/***/ }),
/* 148 */
/***/ (function(module, exports, __webpack_require__) {
var isSameWeek = __webpack_require__(123)
/**
* @category ISO Week Helpers
* @summary Are the given dates in the same ISO week?
*
* @description
* Are the given dates in the same ISO week?
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same ISO week
*
* @example
* // Are 1 September 2014 and 7 September 2014 in the same ISO week?
* var result = isSameISOWeek(
* new Date(2014, 8, 1),
* new Date(2014, 8, 7)
* )
* //=> true
*/
function isSameISOWeek (dirtyDateLeft, dirtyDateRight) {
return isSameWeek(dirtyDateLeft, dirtyDateRight, {weekStartsOn: 1})
}
module.exports = isSameISOWeek
/***/ }),
/* 149 */
/***/ (function(module, exports, __webpack_require__) {
var startOfISOYear = __webpack_require__(8)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Are the given dates in the same ISO week-numbering year?
*
* @description
* Are the given dates in the same ISO week-numbering year?
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same ISO week-numbering year
*
* @example
* // Are 29 December 2003 and 2 January 2005 in the same ISO week-numbering year?
* var result = isSameISOYear(
* new Date(2003, 11, 29),
* new Date(2005, 0, 2)
* )
* //=> true
*/
function isSameISOYear (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfYear = startOfISOYear(dirtyDateLeft)
var dateRightStartOfYear = startOfISOYear(dirtyDateRight)
return dateLeftStartOfYear.getTime() === dateRightStartOfYear.getTime()
}
module.exports = isSameISOYear
/***/ }),
/* 150 */
/***/ (function(module, exports, __webpack_require__) {
var startOfMinute = __webpack_require__(151)
/**
* @category Minute Helpers
* @summary Are the given dates in the same minute?
*
* @description
* Are the given dates in the same minute?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same minute
*
* @example
* // Are 4 September 2014 06:30:00 and 4 September 2014 06:30:15
* // in the same minute?
* var result = isSameMinute(
* new Date(2014, 8, 4, 6, 30),
* new Date(2014, 8, 4, 6, 30, 15)
* )
* //=> true
*/
function isSameMinute (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfMinute = startOfMinute(dirtyDateLeft)
var dateRightStartOfMinute = startOfMinute(dirtyDateRight)
return dateLeftStartOfMinute.getTime() === dateRightStartOfMinute.getTime()
}
module.exports = isSameMinute
/***/ }),
/* 151 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Minute Helpers
* @summary Return the start of a minute for the given date.
*
* @description
* Return the start of a minute for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a minute
*
* @example
* // The start of a minute for 1 December 2014 22:15:45.400:
* var result = startOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))
* //=> Mon Dec 01 2014 22:15:00
*/
function startOfMinute (dirtyDate) {
var date = parse(dirtyDate)
date.setSeconds(0, 0)
return date
}
module.exports = startOfMinute
/***/ }),
/* 152 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Are the given dates in the same month?
*
* @description
* Are the given dates in the same month?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same month
*
* @example
* // Are 2 September 2014 and 25 September 2014 in the same month?
* var result = isSameMonth(
* new Date(2014, 8, 2),
* new Date(2014, 8, 25)
* )
* //=> true
*/
function isSameMonth (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
return dateLeft.getFullYear() === dateRight.getFullYear() &&
dateLeft.getMonth() === dateRight.getMonth()
}
module.exports = isSameMonth
/***/ }),
/* 153 */
/***/ (function(module, exports, __webpack_require__) {
var startOfQuarter = __webpack_require__(154)
/**
* @category Quarter Helpers
* @summary Are the given dates in the same year quarter?
*
* @description
* Are the given dates in the same year quarter?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same quarter
*
* @example
* // Are 1 January 2014 and 8 March 2014 in the same quarter?
* var result = isSameQuarter(
* new Date(2014, 0, 1),
* new Date(2014, 2, 8)
* )
* //=> true
*/
function isSameQuarter (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfQuarter = startOfQuarter(dirtyDateLeft)
var dateRightStartOfQuarter = startOfQuarter(dirtyDateRight)
return dateLeftStartOfQuarter.getTime() === dateRightStartOfQuarter.getTime()
}
module.exports = isSameQuarter
/***/ }),
/* 154 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Quarter Helpers
* @summary Return the start of a year quarter for the given date.
*
* @description
* Return the start of a year quarter for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a quarter
*
* @example
* // The start of a quarter for 2 September 2014 11:55:00:
* var result = startOfQuarter(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Jul 01 2014 00:00:00
*/
function startOfQuarter (dirtyDate) {
var date = parse(dirtyDate)
var currentMonth = date.getMonth()
var month = currentMonth - currentMonth % 3
date.setMonth(month, 1)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfQuarter
/***/ }),
/* 155 */
/***/ (function(module, exports, __webpack_require__) {
var startOfSecond = __webpack_require__(156)
/**
* @category Second Helpers
* @summary Are the given dates in the same second?
*
* @description
* Are the given dates in the same second?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same second
*
* @example
* // Are 4 September 2014 06:30:15.000 and 4 September 2014 06:30.15.500
* // in the same second?
* var result = isSameSecond(
* new Date(2014, 8, 4, 6, 30, 15),
* new Date(2014, 8, 4, 6, 30, 15, 500)
* )
* //=> true
*/
function isSameSecond (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfSecond = startOfSecond(dirtyDateLeft)
var dateRightStartOfSecond = startOfSecond(dirtyDateRight)
return dateLeftStartOfSecond.getTime() === dateRightStartOfSecond.getTime()
}
module.exports = isSameSecond
/***/ }),
/* 156 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Second Helpers
* @summary Return the start of a second for the given date.
*
* @description
* Return the start of a second for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a second
*
* @example
* // The start of a second for 1 December 2014 22:15:45.400:
* var result = startOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))
* //=> Mon Dec 01 2014 22:15:45.000
*/
function startOfSecond (dirtyDate) {
var date = parse(dirtyDate)
date.setMilliseconds(0)
return date
}
module.exports = startOfSecond
/***/ }),
/* 157 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Are the given dates in the same year?
*
* @description
* Are the given dates in the same year?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same year
*
* @example
* // Are 2 September 2014 and 25 September 2014 in the same year?
* var result = isSameYear(
* new Date(2014, 8, 2),
* new Date(2014, 8, 25)
* )
* //=> true
*/
function isSameYear (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
return dateLeft.getFullYear() === dateRight.getFullYear()
}
module.exports = isSameYear
/***/ }),
/* 158 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Week Helpers
* @summary Return the last day of a week for the given date.
*
* @description
* Return the last day of a week for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the last day of a week
*
* @example
* // The last day of a week for 2 September 2014 11:55:00:
* var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sat Sep 06 2014 00:00:00
*
* @example
* // If the week starts on Monday, the last day of the week for 2 September 2014 11:55:00:
* var result = lastDayOfWeek(new Date(2014, 8, 2, 11, 55, 0), {weekStartsOn: 1})
* //=> Sun Sep 07 2014 00:00:00
*/
function lastDayOfWeek (dirtyDate, dirtyOptions) {
var weekStartsOn = dirtyOptions ? (Number(dirtyOptions.weekStartsOn) || 0) : 0
var date = parse(dirtyDate)
var day = date.getDay()
var diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn)
date.setHours(0, 0, 0, 0)
date.setDate(date.getDate() + diff)
return date
}
module.exports = lastDayOfWeek
/***/ }),
/* 159 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var getDaysInMonth = __webpack_require__(116)
/**
* @category Month Helpers
* @summary Set the month to the given date.
*
* @description
* Set the month to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} month - the month of the new date
* @returns {Date} the new date with the month setted
*
* @example
* // Set February to 1 September 2014:
* var result = setMonth(new Date(2014, 8, 1), 1)
* //=> Sat Feb 01 2014 00:00:00
*/
function setMonth (dirtyDate, dirtyMonth) {
var date = parse(dirtyDate)
var month = Number(dirtyMonth)
var year = date.getFullYear()
var day = date.getDate()
var dateWithDesiredMonth = new Date(0)
dateWithDesiredMonth.setFullYear(year, month, 15)
dateWithDesiredMonth.setHours(0, 0, 0, 0)
var daysInMonth = getDaysInMonth(dateWithDesiredMonth)
// Set the last day of the new month
// if the original date was the last day of the longer month
date.setMonth(month, Math.min(day, daysInMonth))
return date
}
module.exports = setMonth
/***/ }),
/* 160 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 161 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 162 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 163 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 164 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 165 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 166 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 167 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 168 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 169 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 170 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 171 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 172 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 173 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 174 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 175 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 176 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 177 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 178 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 179 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 180 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 181 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 182 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 183 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 184 */
/***/ (function(module, exports) {
module.exports = {"typings":"../typings.d.ts"}
/***/ }),
/* 185 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 186 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 187 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 188 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 189 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 190 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 191 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 192 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 193 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 194 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 195 */
/***/ (function(module, exports) {
module.exports = {"typings":"../../typings.d.ts"}
/***/ }),
/* 196 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__bulma_accordion_src_js_index_js__ = __webpack_require__(197);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__bulma_calendar_src_js_index_js__ = __webpack_require__(199);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__bulma_carousel_src_js_index_js__ = __webpack_require__(305);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__bulma_iconpicker_src_js_index_js__ = __webpack_require__(308);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__bulma_quickview_src_js_index_js__ = __webpack_require__(311);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__bulma_slider_src_js_index_js__ = __webpack_require__(314);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__bulma_steps_src_js_index_js__ = __webpack_require__(317);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__bulma_tagsinput_src_js_index_js__ = __webpack_require__(320);
/* harmony default export */ __webpack_exports__["default"] = ({
bulmaAccordion: __WEBPACK_IMPORTED_MODULE_0__bulma_accordion_src_js_index_js__["a" /* default */],
bulmaCalendar: __WEBPACK_IMPORTED_MODULE_1__bulma_calendar_src_js_index_js__["a" /* default */],
bulmaCarousel: __WEBPACK_IMPORTED_MODULE_2__bulma_carousel_src_js_index_js__["a" /* default */],
bulmaIconpicker: __WEBPACK_IMPORTED_MODULE_3__bulma_iconpicker_src_js_index_js__["a" /* default */],
bulmaQuickview: __WEBPACK_IMPORTED_MODULE_4__bulma_quickview_src_js_index_js__["a" /* default */],
bulmaSlider: __WEBPACK_IMPORTED_MODULE_5__bulma_slider_src_js_index_js__["a" /* default */],
bulmaSteps: __WEBPACK_IMPORTED_MODULE_6__bulma_steps_src_js_index_js__["a" /* default */],
bulmaTagsinput: __WEBPACK_IMPORTED_MODULE_7__bulma_tagsinput_src_js_index_js__["a" /* default */]
});
/***/ }),
/* 197 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(198);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var onBulmaAccordionClick = Symbol('onBulmaAccordionClick');
var bulmaAccordion = function (_EventEmitter) {
_inherits(bulmaAccordion, _EventEmitter);
function bulmaAccordion(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaAccordion);
var _this = _possibleConstructorReturn(this, (bulmaAccordion.__proto__ || Object.getPrototypeOf(bulmaAccordion)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
_this[onBulmaAccordionClick] = _this[onBulmaAccordionClick].bind(_this);
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaAccordion, [{
key: 'init',
/**
* Initiate plugin
* @method init
* @return {void}
*/
value: function init() {
this.items = this.element.querySelectorAll('.accordion') || [];
this._bindEvents();
}
}, {
key: 'destroy',
value: function destroy() {
var _this2 = this;
this.items.forEach(function (item) {
_this2._clickEvents.forEach(function (clickEvent) {
item.removeEventListener(clickEvent, _this2[onBulmaAccordionClick], false);
});
});
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
var _this3 = this;
this.items.forEach(function (item) {
_this3._clickEvents.forEach(function (clickEvent) {
item.addEventListener(clickEvent, _this3[onBulmaAccordionClick], false);
});
});
}
/**
* Toggle accordion item
* @method onBulmaAccordionClick
* @param {Event} e click event
* @return {void}
*/
}, {
key: onBulmaAccordionClick,
value: function value(e) {
e.preventDefault();
var target = e.currentTarget.closest('.accordion') || e.currentTarget;
if (!target.classList.contains('is-active')) {
var activeItem = this.element.querySelector('.accordion.is-active');
if (activeItem) {
activeItem.classList.remove('is-active');
}
target.classList.add('is-active');
} else {
target.classList.remove('is-active');
}
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.accordions';
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaAccordion(element));
}, 100);
});
return instances;
}
}]);
return bulmaAccordion;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaAccordion);
/***/ }),
/* 198 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 199 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_index__ = __webpack_require__(200);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_type__ = __webpack_require__(201);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_date_fns__ = __webpack_require__(124);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_date_fns___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_date_fns__);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils_events__ = __webpack_require__(300);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__defaultOptions__ = __webpack_require__(301);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__templates_calendar__ = __webpack_require__(302);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__templates_days__ = __webpack_require__(303);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var onToggleDatePicker = Symbol('onToggleDatePicker');
var onCloseDatePicker = Symbol('onCloseDatePicker');
var onPreviousDatePicker = Symbol('onPreviousDatePicker');
var onNextDatePicker = Symbol('onNextDatePicker');
var onSelectMonthDatePicker = Symbol('onSelectMonthDatePicker');
var onMonthClickDatePicker = Symbol('onMonthClickDatePicker');
var onSelectYearDatePicker = Symbol('onSelectYearDatePicker');
var onYearClickDatePicker = Symbol('onYearClickDatePicker');
var onDateClickDatePicker = Symbol('onDateClickDatePicker');
var onDocumentClickDatePicker = Symbol('onDocumentClickDatePicker');
var onValidateClickDatePicker = Symbol('onValidateClickDatePicker');
var onTodayClickDatePicker = Symbol('onTodayClickDatePicker');
var onClearClickDatePicker = Symbol('onClearClickDatePicker');
var onCancelClickDatePicker = Symbol('onCancelClickDatePicker');
var _supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function get() {
_supportsPassive = true;
}
});
window.addEventListener('testPassive', null, opts);
window.removeEventListener('testPassive', null, opts);
} catch (e) {}
var bulmaCalendar = function (_EventEmitter) {
_inherits(bulmaCalendar, _EventEmitter);
function bulmaCalendar(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaCalendar);
var _this = _possibleConstructorReturn(this, (bulmaCalendar.__proto__ || Object.getPrototypeOf(bulmaCalendar)).call(this));
_this.element = __WEBPACK_IMPORTED_MODULE_1__utils_type__["a" /* isString */](selector) ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click', 'touch'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_4__defaultOptions__["a" /* default */], options);
_this[onToggleDatePicker] = _this[onToggleDatePicker].bind(_this);
_this[onCloseDatePicker] = _this[onCloseDatePicker].bind(_this);
_this[onPreviousDatePicker] = _this[onPreviousDatePicker].bind(_this);
_this[onNextDatePicker] = _this[onNextDatePicker].bind(_this);
_this[onSelectMonthDatePicker] = _this[onSelectMonthDatePicker].bind(_this);
_this[onMonthClickDatePicker] = _this[onMonthClickDatePicker].bind(_this);
_this[onSelectYearDatePicker] = _this[onSelectYearDatePicker].bind(_this);
_this[onYearClickDatePicker] = _this[onYearClickDatePicker].bind(_this);
_this[onDateClickDatePicker] = _this[onDateClickDatePicker].bind(_this);
_this[onDocumentClickDatePicker] = _this[onDocumentClickDatePicker].bind(_this);
_this[onValidateClickDatePicker] = _this[onValidateClickDatePicker].bind(_this);
_this[onTodayClickDatePicker] = _this[onTodayClickDatePicker].bind(_this);
_this[onClearClickDatePicker] = _this[onClearClickDatePicker].bind(_this);
_this[onCancelClickDatePicker] = _this[onCancelClickDatePicker].bind(_this);
// Initiate plugin
_this._init();
return _this;
}
/**
* Initiate all DOM element containing datePicker class
* @method
* @return {Array} Array of all datePicker instances
*/
_createClass(bulmaCalendar, [{
key: 'isRange',
/****************************************************
* *
* PUBLIC FUNCTIONS *
* *
****************************************************/
value: function isRange() {
return this.options.isRange;
}
/**
* Returns true if calendar picker is open, otherwise false.
* @method isOpen
* @return {boolean}
*/
}, {
key: 'isOpen',
value: function isOpen() {
return this._open;
}
/**
* Get / Set datePicker value
* @param {*} date
*/
}, {
key: 'value',
value: function value() {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (date) {
if (this.options.isRange) {
var dates = this.element.value.split(' - ');
if (dates.length) {
this.startDate = new Date(dates[0]);
}
if (dates.length === 2) {
this.endDate = new Date(dates[1]);
}
} else {
this.startDate = new Date(this.element.value);
}
} else {
var value = '';
if (this.options.isRange) {
if (this.startDate && this._isValidDate(this.startDate) && this.endDate && this._isValidDate(this.endDate)) {
value = __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.startDate, this.dateFormat, { locale: this.locale }) + ' - ' + __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.endDate, this.dateFormat, { locale: this.locale });
}
} else if (this.startDate && this._isValidDate(this.startDate)) {
value = __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.startDate, this._dateFormat, {
locale: this.locale
});
}
this.emit('date:selected', this.date, this);
return value;
}
}
}, {
key: 'clear',
value: function clear() {
this._clear();
}
/**
* Show datePicker HTML Component
* @method show
* @return {void}
*/
}, {
key: 'show',
value: function show() {
this._snapshots = [];
this._snapshot();
if (this.element.value) {
this.value(this.element.value);
}
this._visibleDate = this._isValidDate(this.startDate, this.minDate, this.maxDate) ? this.startDate : this._visibleDate;
this._refreshCalendar();
this._ui.body.dates.classList.add('is-active');
this._ui.body.months.classList.remove('is-active');
this._ui.body.years.classList.remove('is-active');
this._ui.navigation.previous.removeAttribute('disabled');
this._ui.navigation.next.removeAttribute('disabled');
this._ui.container.classList.add('is-active');
if (this.options.displayMode === 'default') {
this._adjustPosition();
}
this._open = true;
this._focus = true;
this.emit('show', this);
}
/**
* Hide datePicker HTML Component
* @method hide
* @return {void}
*/
}, {
key: 'hide',
value: function hide() {
this._open = false;
this._focus = false;
this._ui.container.classList.remove('is-active');
this.emit('hide', this);
}
/**
* Destroy datePicker
* @method destroy
* @return {[type]} [description]
*/
}, {
key: 'destroy',
value: function destroy() {
this._ui.container.remove();
}
/****************************************************
* *
* EVENTS FUNCTIONS *
* *
****************************************************/
}, {
key: onDocumentClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
if (this.options.displayMode !== 'inline' && this._open) {
this[onCloseDatePicker](e);
}
}
}, {
key: onToggleDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
if (this._open) {
this.hide();
} else {
this.show();
}
}
}, {
key: onValidateClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
this[onCloseDatePicker](e);
}
}, {
key: onTodayClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
if (!this.options.isRange) {
this.startDate = new Date();
this._visibleDate = this.startDate;
} else {
this._setStartAndEnd(new Date());
this._visibleDate = this.startDate;
}
this.element.value = this.value();
this._refreshCalendar();
}
}, {
key: onClearClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
this._clear();
}
}, {
key: onCancelClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
if (this._snapshots.length) {
this.startDate = this._snapshots[0].start;
this.endDate = this._snapshots[0].end;
}
this.element.value = this.value();
this[onCloseDatePicker](e);
}
}, {
key: onCloseDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
this.hide();
}
}, {
key: onPreviousDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
var prevMonth = __WEBPACK_IMPORTED_MODULE_2_date_fns__["lastDayOfMonth"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["subMonths"](new Date(__WEBPACK_IMPORTED_MODULE_2_date_fns__["getYear"](this._visibleDate), __WEBPACK_IMPORTED_MODULE_2_date_fns__["getMonth"](this._visibleDate)), 1));
var day = Math.min(__WEBPACK_IMPORTED_MODULE_2_date_fns__["getDaysInMonth"](prevMonth), __WEBPACK_IMPORTED_MODULE_2_date_fns__["getDate"](this._visibleDate));
this._visibleDate = this.minDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["max"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["setDate"](prevMonth, day), this.minDate) : __WEBPACK_IMPORTED_MODULE_2_date_fns__["setDate"](prevMonth, day);
this._refreshCalendar();
}
}, {
key: onNextDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
var nextMonth = __WEBPACK_IMPORTED_MODULE_2_date_fns__["addMonths"](this._visibleDate, 1);
var day = Math.min(__WEBPACK_IMPORTED_MODULE_2_date_fns__["getDaysInMonth"](nextMonth), __WEBPACK_IMPORTED_MODULE_2_date_fns__["getDate"](this._visibleDate));
this._visibleDate = this.maxDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["min"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["setDate"](nextMonth, day), this.maxDate) : __WEBPACK_IMPORTED_MODULE_2_date_fns__["setDate"](nextMonth, day);
this._refreshCalendar();
}
}, {
key: onDateClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
if (!e.currentTarget.classList.contains('is-disabled')) {
this._setStartAndEnd(e.currentTarget.dataset.date);
this._refreshCalendar();
if (this.options.displayMode === 'inline' || this.options.closeOnSelect) {
this.element.value = this.value();
}
if ((!this.options.isRange || this.startDate && this._isValidDate(this.startDate) && this.endDate && this._isValidDate(this.endDate)) && this.options.closeOnSelect) {
this.hide();
}
}
}
}, {
key: onSelectMonthDatePicker,
value: function value(e) {
e.stopPropagation();
this._ui.body.dates.classList.remove('is-active');
this._ui.body.years.classList.remove('is-active');
this._ui.body.months.classList.add('is-active');
this._ui.navigation.previous.setAttribute('disabled', 'disabled');
this._ui.navigation.next.setAttribute('disabled', 'disabled');
}
}, {
key: onSelectYearDatePicker,
value: function value(e) {
e.stopPropagation();
this._ui.body.dates.classList.remove('is-active');
this._ui.body.months.classList.remove('is-active');
this._ui.body.years.classList.add('is-active');
this._ui.navigation.previous.setAttribute('disabled', 'disabled');
this._ui.navigation.next.setAttribute('disabled', 'disabled');
var currentYear = this._ui.body.years.querySelector('.calendar-year.is-active');
if (currentYear) {
this._ui.body.years.scrollTop = currentYear.offsetTop - this._ui.body.years.offsetTop - this._ui.body.years.clientHeight / 2;
}
}
}, {
key: onMonthClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
var newDate = __WEBPACK_IMPORTED_MODULE_2_date_fns__["setMonth"](this._visibleDate, parseInt(e.currentTarget.dataset.month) - 1);
this._visibleDate = this.minDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["max"](newDate, this.minDate) : newDate;
this._visibleDate = this.maxDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["min"](this._visibleDate, this.maxDate) : this._visibleDate;
this._refreshCalendar();
}
}, {
key: onYearClickDatePicker,
value: function value(e) {
if (!_supportsPassive) {
e.preventDefault();
}
e.stopPropagation();
var newDate = __WEBPACK_IMPORTED_MODULE_2_date_fns__["setYear"](this._visibleDate, parseInt(e.currentTarget.dataset.year));
this._visibleDate = this.minDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["max"](newDate, this.minDate) : newDate;
this._visibleDate = this.maxDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["min"](this._visibleDate, this.maxDate) : this._visibleDate;
this._refreshCalendar();
}
/****************************************************
* *
* PRIVATE FUNCTIONS *
* *
****************************************************/
/**
* Initiate plugin instance
* @method _init
* @return {datePicker} Current plugin instance
*/
}, {
key: '_init',
value: function _init() {
var _this2 = this;
this._id = __WEBPACK_IMPORTED_MODULE_0__utils_index__["a" /* uuid */]('datePicker');
this._snapshots = [];
// Cahnge element type to prevent browser default type="date" behavior
if (this.element.getAttribute('type').toLowerCase() === 'date') {
this.element.setAttribute('type', 'text');
}
// Use Element dataset values to override options
var elementConfig = this.element.dataset ? Object.keys(this.element.dataset).filter(function (key) {
return Object.keys(__WEBPACK_IMPORTED_MODULE_4__defaultOptions__["a" /* default */]).includes(key);
}).reduce(function (obj, key) {
return _extends({}, obj, _defineProperty({}, key, _this2.element.dataset[key]));
}, {}) : {};
this.options = _extends({}, this.options, elementConfig);
this.lang = this.options.lang;
this.dateFormat = this.options.dateFormat || 'MM/DD/YYYY';
this._date = {
start: undefined,
end: undefined
};
this._open = false;
if (this.options.displayMode !== 'inline' && window.matchMedia('screen and (max-width: 768px)').matches) {
this.options.displayMode = 'dialog';
}
this._initDates();
this._build();
this._bindEvents();
this.emit('ready', this);
return this;
}
// Init dates used by datePicker core system
}, {
key: '_initDates',
value: function _initDates() {
// Transform start date according to dateFormat option
this.minDate = this.options.minDate;
this.maxDate = this.options.maxDate;
var today = new Date();
var startDateToday = this._isValidDate(today, this.options.minDate, this.options.maxDate) ? today : this.options.minDate;
this.startDate = this.options.startDate;
this.endDate = this.options.isRange ? this.options.endDate : undefined;
if (this.element.value) {
if (this.options.isRange) {
var dates = this.element.value.split(' - ');
if (dates.length) {
this.startDate = new Date(dates[0]);
}
if (dates.length === 2) {
this.endDate = new Date(dates[1]);
}
} else {
this.startDate = new Date(this.element.value);
}
}
this._visibleDate = this._isValidDate(this.startDate) ? this.startDate : startDateToday;
if (this.options.disabledDates) {
if (!Array.isArray(this.options.disabledDates)) {
this.options.disabledDates = [this.options.disabledDates];
}
for (var i = 0; i < this.options.disabledDates.length; i++) {
this.options.disabledDates[i] = __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.options.disabledDates[i], this.options.dateFormat, {
locale: this.locale
});
}
}
this._snapshot();
}
/**
* Build datePicker HTML component and append it to the DOM
* @method _build
* @return {datePicker} Current plugin instance
*/
}, {
key: '_build',
value: function _build() {
var _this3 = this;
// the 7 days of the week (Sun-Sat)
var labels = new Array(7).fill(__WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfWeek"](this._visibleDate)).map(function (d, i) {
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["addDays"](d, i + _this3.options.weekStart), 'ddd', {
locale: _this3.locale
});
});
// the 12 months of the year (Jan-SDecat)
var months = new Array(12).fill(__WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfWeek"](this._visibleDate)).map(function (d, i) {
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["addMonths"](d, i), 'MM', {
locale: _this3.locale
});
});
// the 7 days of the week (Sun-Sat)
var years = new Array(100).fill(__WEBPACK_IMPORTED_MODULE_2_date_fns__["subYears"](this._visibleDate, 50)).map(function (d, i) {
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["addYears"](d, i), 'YYYY', {
locale: _this3.locale
});
});
// Create datePicker HTML Fragment based on Template
var datePickerFragment = document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_5__templates_calendar__["a" /* default */])(_extends({}, this.options, {
id: this.id,
date: this.date,
locale: this.locale,
visibleDate: this._visibleDate,
labels: {
from: this.options.labelFrom,
to: this.options.labelTo,
weekdays: labels
},
months: months,
years: years,
isRange: this.options.isRange,
month: __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.month, 'MM', {
locale: this.locale
})
})));
// Save pointer to each datePicker element for later use
var container = datePickerFragment.querySelector('#' + this.id);
this._ui = {
container: container,
calendar: container.querySelector('.calendar'),
overlay: this.options.displayMode === 'dialog' ? {
background: container.querySelector('.modal-background'),
close: container.querySelector('.modal-close')
} : undefined,
header: {
container: container.querySelector('.calendar-header'),
start: {
container: container.querySelector('.calendar-selection-start'),
day: container.querySelector('.calendar-selection-start .calendar-selection-day'),
month: container.querySelector('.calendar-selection-start .calendar-selection-month'),
weekday: container.querySelector('.calendar-selection-start .calendar-selection-weekday'),
empty: container.querySelector('.calendar-selection-start .empty')
},
end: this.options.isRange ? {
container: container.querySelector('.calendar-selection-end'),
day: container.querySelector('.calendar-selection-end .calendar-selection-day'),
month: container.querySelector('.calendar-selection-end .calendar-selection-month'),
weekday: container.querySelector('.calendar-selection-end .calendar-selection-weekday'),
empty: container.querySelector('.calendar-selection-start .empty')
} : undefined
},
navigation: {
container: container.querySelector('.calendar-nav'),
previous: container.querySelector('.calendar-nav-previous'),
next: container.querySelector('.calendar-nav-next'),
month: container.querySelector('.calendar-nav-month'),
year: container.querySelector('.calendar-nav-year')
},
footer: {
container: container.querySelector('.calendar-footer'),
validate: container.querySelector('.calendar-footer-validate'),
today: container.querySelector('.calendar-footer-today'),
clear: container.querySelector('.calendar-footer-clear'),
cancel: container.querySelector('.calendar-footer-cancel')
},
body: {
dates: container.querySelector('.calendar-dates'),
days: container.querySelector('.calendar-days'),
weekdays: container.querySelector('.calendar-weekdays'),
months: container.querySelector('.calendar-months'),
years: container.querySelector('.calendar-years')
}
};
if (!this.options.showHeader) {
this._ui.header.container.classList.add('is-hidden');
}
if (!this.options.showFooter) {
this._ui.footer.container.classList.add('is-hidden');
}
if (!this.options.todayButton) {
this._ui.footer.todayB.classList.add('is-hidden');
}
if (!this.options.clearButton) {
this._ui.footer.clear.classList.add('is-hidden');
}
if (this.options.displayMode === 'inline' && this._ui.footer.validate) {
this._ui.footer.validate.classList.add('is-hidden');
}
if (this.options.displayMode === 'inline' && this._ui.footer.cancel) {
this._ui.footer.cancel.classList.add('is-hidden');
}
if (this.options.closeOnSelect && this._ui.footer.validate) {
this._ui.footer.validate.classList.add('is-hidden');
}
// Add datepicker HTML element to Document Body
if (this.options.displayMode === 'inline') {
var wrapper = document.createElement('div');
this.element.parentNode.insertBefore(wrapper, this.element);
wrapper.appendChild(this.element);
this.element.classList.add('is-hidden');
wrapper.appendChild(datePickerFragment);
container.classList.remove('datepicker');
this._refreshCalendar();
} else {
document.body.appendChild(datePickerFragment);
}
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
var _this4 = this;
// Bind event to element in order to display/hide datePicker on click
// this._clickEvents.forEach(clickEvent => {
// window.addEventListener(clickEvent, this[onDocumentClickDatePicker]);
// });
window.addEventListener('scroll', function () {
if (_this4.options.displayMode === 'default') {
console('Scroll');
_this4._adjustPosition();
}
});
document.addEventListener('keydown', function (e) {
if (_this4._focus) {
switch (e.keyCode || e.which) {
case 37:
_this4[onPreviousDatePicker](e);
break;
case 39:
_this4[onNextDatePicker](e);
break;
}
}
});
// Bind event to element in order to display/hide datePicker on click
if (this.options.toggleOnInputClick === true) {
this._clickEvents.forEach(function (clickEvent) {
_this4.element.addEventListener(clickEvent, _this4[onToggleDatePicker]);
});
}
if (this.options.displayMode === 'dialog' && this._ui.overlay) {
// Bind close event on Close button
if (this._ui.overlay.close) {
this._clickEvents.forEach(function (clickEvent) {
_this4.this._ui.overlay.close.addEventListener(clickEvent, _this4[onCloseDatePicker]);
});
}
// Bind close event on overlay based on options
if (this.options.closeOnOverlayClick && this._ui.overlay.background) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.overlay.background.addEventListener(clickEvent, _this4[onCloseDatePicker]);
});
}
}
// Bind year navigation events
if (this._ui.navigation.previous) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.navigation.previous.addEventListener(clickEvent, _this4[onPreviousDatePicker]);
});
}
if (this._ui.navigation.next) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.navigation.next.addEventListener(clickEvent, _this4[onNextDatePicker]);
});
}
if (this._ui.navigation.month) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.navigation.month.addEventListener(clickEvent, _this4[onSelectMonthDatePicker]);
});
}
if (this._ui.navigation.year) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.navigation.year.addEventListener(clickEvent, _this4[onSelectYearDatePicker]);
});
}
var months = this._ui.body.months.querySelectorAll('.calendar-month') || [];
months.forEach(function (month) {
_this4._clickEvents.forEach(function (clickEvent) {
month.addEventListener(clickEvent, _this4[onMonthClickDatePicker]);
});
});
var years = this._ui.body.years.querySelectorAll('.calendar-year') || [];
years.forEach(function (year) {
_this4._clickEvents.forEach(function (clickEvent) {
year.addEventListener(clickEvent, _this4[onYearClickDatePicker]);
});
});
if (this._ui.footer.validate) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.footer.validate.addEventListener(clickEvent, _this4[onValidateClickDatePicker]);
});
}
if (this._ui.footer.today) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.footer.today.addEventListener(clickEvent, _this4[onTodayClickDatePicker]);
});
}
if (this._ui.footer.clear) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.footer.clear.addEventListener(clickEvent, _this4[onClearClickDatePicker]);
});
}
if (this._ui.footer.cancel) {
this._clickEvents.forEach(function (clickEvent) {
_this4._ui.footer.cancel.addEventListener(clickEvent, _this4[onCancelClickDatePicker]);
});
}
}
/**
* Bind events on each Day item
* @method _bindDaysEvents
* @return {void}
*/
}, {
key: '_bindDaysEvents',
value: function _bindDaysEvents() {
var _this5 = this;
[].forEach.call(this._ui.days, function (day) {
_this5._clickEvents.forEach(function (clickEvent) {
// if not in range, no click action
// if in this month, select the date
// if out of this month, jump to the date
var onClick = !_this5._isValidDate(new Date(day.dataset.date), _this5.minDate, _this5.maxDate) ? null : _this5[onDateClickDatePicker];
day.addEventListener(clickEvent, onClick);
});
day.addEventListener('hover', function (e) {
e.preventDEfault();
});
});
}
}, {
key: '_renderDays',
value: function _renderDays() {
var _this6 = this;
// first day of current month view
var start = __WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfWeek"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfMonth"](this._visibleDate));
// last day of current month view
var end = __WEBPACK_IMPORTED_MODULE_2_date_fns__["endOfWeek"](__WEBPACK_IMPORTED_MODULE_2_date_fns__["endOfMonth"](this._visibleDate));
// get all days and whether they are within the current month and range
var days = new Array(__WEBPACK_IMPORTED_MODULE_2_date_fns__["differenceInDays"](end, start) + 1).fill(start).map(function (s, i) {
var theDate = __WEBPACK_IMPORTED_MODULE_2_date_fns__["addDays"](s, i + _this6.options.weekStart);
var isThisMonth = __WEBPACK_IMPORTED_MODULE_2_date_fns__["isSameMonth"](_this6._visibleDate, theDate);
var isInRange = _this6.options.isRange && __WEBPACK_IMPORTED_MODULE_2_date_fns__["isWithinRange"](theDate, _this6.startDate, _this6.endDate);
var isDisabled = _this6.maxDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["isAfter"](theDate, _this6.maxDate) : false;
isDisabled = _this6.minDate ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["isBefore"](theDate, _this6.minDate) : isDisabled;
if (_this6.options.disabledDates) {
for (var j = 0; j < _this6.options.disabledDates.length; j++) {
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["getTime"](theDate) == __WEBPACK_IMPORTED_MODULE_2_date_fns__["getTime"](_this6.options.disabledDates[j])) {
isDisabled = true;
}
}
}
if (_this6.options.disabledWeekDays) {
var disabledWeekDays = __WEBPACK_IMPORTED_MODULE_1__utils_type__["a" /* isString */](_this6.options.disabledWeekDays) ? _this6.options.disabledWeekDays.split(',') : _this6.options.disabledWeekDays;
disabledWeekDays.forEach(function (day) {
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["getDay"](theDate) == day) {
isDisabled = true;
}
});
}
return {
date: theDate,
isRange: _this6.options.isRange,
isToday: __WEBPACK_IMPORTED_MODULE_2_date_fns__["isToday"](theDate),
isStartDate: __WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](_this6.startDate, theDate),
isEndDate: __WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](_this6.endDate, theDate),
isDisabled: isDisabled,
isThisMonth: isThisMonth,
isInRange: isInRange
};
});
this._ui.body.days.appendChild(document.createRange().createContextualFragment(Object(__WEBPACK_IMPORTED_MODULE_6__templates_days__["a" /* default */])(days)));
this._ui.days = this._ui.body.days.querySelectorAll('.calendar-date');
this._bindDaysEvents();
this.emit('rendered', this);
}
}, {
key: '_togglePreviousButton',
value: function _togglePreviousButton() {
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (!active) {
this._ui.navigation.previous.setAttribute('disabled', 'disabled');
} else {
this._ui.navigation.previous.removeAttribute('disabled');
}
}
}, {
key: '_toggleNextButton',
value: function _toggleNextButton() {
var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (!active) {
this._ui.navigation.next.setAttribute('disabled', 'disabled');
} else {
this._ui.navigation.next.removeAttribute('disabled');
}
}
}, {
key: '_setStartAndEnd',
value: function _setStartAndEnd(date) {
var _this7 = this;
this._snapshot();
if (this.options.isRange && (!this._isValidDate(this.startDate) || this._isValidDate(this.startDate) && this._isValidDate(this.endDate))) {
this.startDate = new Date(date);
this.endDate = undefined;
this.emit('startDate:selected', this.date, this);
} else if (this.options.isRange && !this._isValidDate(this.endDate)) {
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["isBefore"](date, this.startDate)) {
this.endDate = this.startDate;
this.startDate = new Date(date);
this.emit('startDate:selected', this.date, this);
this.emit('endDate:selected', this.date, this);
} else if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["isAfter"](date, this.startDate)) {
this.endDate = new Date(date);
this.emit('endDate:selected', this.date, this);
} else {
this.startDate = new Date(date);
this.endDate = undefined;
}
} else {
this.startDate = new Date(date);
this.endDate = undefined;
}
if (this.options.isRange && this._isValidDate(this.startDate) && this._isValidDate(this.endDate)) {
new Array(__WEBPACK_IMPORTED_MODULE_2_date_fns__["differenceInDays"](this.endDate, this.startDate) + 1).fill(this.startDate).map(function (s, i) {
var theDate = __WEBPACK_IMPORTED_MODULE_2_date_fns__["addDays"](s, i);
var dateElement = _this7._ui.body.dates.querySelector('.calendar-date[data-date="' + theDate.toString() + '"]');
if (dateElement) {
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](_this7.startDate, theDate)) {
dateElement.classList.add('calendar-range-start');
}
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](_this7.endDate, theDate)) {
dateElement.classList.add('calendar-range-end');
}
dateElement.classList.add('calendar-range');
}
});
}
}
}, {
key: '_clear',
value: function _clear() {
this.startDate = undefined;
this.endDate = undefined;
this.element.value = this.value();
if (this.options.displayMode !== 'inline' && this._open) {
this.hide();
}
this._refreshCalendar();
}
/**
* Refresh calendar with new year/month days
* @method _refreshCalendar
* @return {[type]} [description]
*/
}, {
key: '_refreshCalendar',
value: function _refreshCalendar() {
var _this8 = this;
// this.elementCalendarNavDay.innerHTML = this.date.date();
this._ui.body.days.innerHTML = '';
if (this.minDate && __WEBPACK_IMPORTED_MODULE_2_date_fns__["differenceInMonths"](this._visibleDate, this.minDate) === 0) {
this._togglePreviousButton(false);
} else {
this._togglePreviousButton();
}
if (this.maxDate && __WEBPACK_IMPORTED_MODULE_2_date_fns__["differenceInMonths"](this._visibleDate, this.maxDate) === 0) {
this._toggleNextButton(false);
} else {
this._toggleNextButton();
}
this._refreshCalendarHeader();
this._ui.navigation.month.innerHTML = __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this._visibleDate, 'MMMM', {
locale: this.locale
});
this._ui.navigation.year.innerHTML = __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this._visibleDate, 'YYYY', {
locale: this.locale
});
var months = this._ui.body.months.querySelectorAll('.calendar-month') || [];
months.forEach(function (month) {
month.classList.remove('is-active');
if (month.dataset.month === __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](_this8._visibleDate, 'MM', {
locale: _this8.locale
})) {
month.classList.add('is-active');
}
});
var years = this._ui.body.years.querySelectorAll('.calendar-year') || [];
years.forEach(function (year) {
year.classList.remove('is-active');
if (year.dataset.year === __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](_this8._visibleDate, 'YYYY', {
locale: _this8.locale
})) {
year.classList.add('is-active');
}
});
this._renderDays();
this._ui.body.dates.classList.add('is-active');
this._ui.body.months.classList.remove('is-active');
this._ui.body.years.classList.remove('is-active');
this._ui.navigation.previous.removeAttribute('disabled');
this._ui.navigation.next.removeAttribute('disabled');
return this;
}
}, {
key: '_refreshCalendarHeader',
value: function _refreshCalendarHeader() {
this._ui.header.start.day.innerHTML = this._isValidDate(this.startDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["getDate"](this.startDate) : ' ';
this._ui.header.start.weekday.innerHTML = this._isValidDate(this.startDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.startDate, 'dddd', {
locale: this.locale
}) : ' ';
this._ui.header.start.month.innerHTML = this._isValidDate(this.startDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.startDate, 'MMMM YYYY', {
locale: this.locale
}) : ' ';
if (this._ui.header.end) {
this._ui.header.end.day.innerHTML = this.options.isRange && this._isValidDate(this.endDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["getDate"](this.endDate) : ' ';
this._ui.header.end.weekday.innerHTML = this.options.isRange && this._isValidDate(this.endDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.endDate, 'dddd', {
locale: this.locale
}) : ' ';
this._ui.header.end.month.innerHTML = this.options.isRange && this._isValidDate(this.endDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["format"](this.endDate, 'MMMM YYYY', {
locale: this.locale
}) : ' ';
}
}
/**
* Recalculate calendar position
* @method _adjustPosition
* @return {void}
*/
}, {
key: '_adjustPosition',
value: function _adjustPosition() {
//var width = this.elementCalendar.offsetWidth,
// height = this.elementCalendar.offsetHeight,
// viewportWidth = window.innerWidth || document.documentElement.clientWidth,
// viewportHeight = window.innerHeight || document.documentElement.clientHeight,
// scrollTop = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop,
var left = void 0,
top = void 0,
clientRect = void 0;
if (typeof this.element.getBoundingClientRect === 'function') {
clientRect = this.element.getBoundingClientRect();
left = clientRect.left + window.pageXOffset;
top = clientRect.bottom + window.pageYOffset;
} else {
left = this.element.offsetLeft;
top = this.element.offsetTop + this.element.offsetHeight;
while (this.element = this.element.offsetParent) {
left += this.element.offsetLeft;
top += this.element.offsetTop;
}
}
this._ui.container.style.position = 'absolute';
this._ui.container.style.left = left + 'px';
this._ui.container.style.top = top + 'px';
}
}, {
key: '_isValidDate',
value: function _isValidDate(date, minDate, maxDate) {
try {
if (!date) {
return false;
}
if (__WEBPACK_IMPORTED_MODULE_2_date_fns__["isValid"](date)) {
if (!minDate && !maxDate) {
return true;
}
if (minDate && maxDate) {
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["isWithinRange"](date, minDate, maxDate);
}
if (maxDate) {
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["isBefore"](date, maxDate) || __WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](date, maxDate);
}
return __WEBPACK_IMPORTED_MODULE_2_date_fns__["isAfter"](date, minDate) || __WEBPACK_IMPORTED_MODULE_2_date_fns__["isEqual"](date, minDate);
} else {
return false;
}
} catch (e) {
return false;
}
}
}, {
key: '_snapshot',
value: function _snapshot() {
this._snapshots.push(_extends({}, this._date));
}
}, {
key: 'id',
/****************************************************
* *
* GETTERS and SETTERS *
* *
****************************************************/
/**
* Get id of current datePicker
*/
get: function get() {
return this._id;
}
// Get current datePicker language
}, {
key: 'lang',
get: function get() {
return this._lang;
}
// Set datePicker language
,
set: function set() {
var lang = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en';
this._lang = lang;
this._locale = __webpack_require__(304)("./" + lang);
}
}, {
key: 'locale',
get: function get() {
return this._locale;
}
// Get date object
}, {
key: 'date',
get: function get() {
return this._date || {
start: undefined,
end: undefined
};
}
}, {
key: 'startDate',
get: function get() {
return this._date.start;
},
set: function set(date) {
this._date.start = date ? this._isValidDate(date, this.minDate, this.maxDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfDay"](date) : this._date.start : undefined;
}
}, {
key: 'endDate',
get: function get() {
return this._date.end;
},
set: function set(date) {
this._date.end = date ? this._isValidDate(date, this.minDate, this.maxDate) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfDay"](date) : this._date.end : undefined;
}
// Get minDate
}, {
key: 'minDate',
get: function get() {
return this._minDate;
}
// Set minDate
,
set: function set() {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
this._minDate = date ? this._isValidDate(date) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfDay"](date) : this._minDate : undefined;
return this;
}
// Get maxDate
}, {
key: 'maxDate',
get: function get() {
return this._maxDate;
}
// Set maxDate
,
set: function set() {
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
this._maxDate = date ? this._isValidDate(date) ? __WEBPACK_IMPORTED_MODULE_2_date_fns__["startOfDay"](date) : this._maxDate : undefined;
return this;
}
// Get dateFormat
}, {
key: 'dateFormat',
get: function get() {
return this._dateFormat;
}
// Set dateFormat (set to yyyy-mm-dd by default)
,
set: function set(dateFormat) {
this._dateFormat = dateFormat;
return this;
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'input[type="date"]';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var datepickerInstances = new Array();
var datepickers = __WEBPACK_IMPORTED_MODULE_1__utils_type__["a" /* isString */](selector) ? document.querySelectorAll(selector) : Array.isArray(selector) ? selector : [selector];
[].forEach.call(datepickers, function (datepicker) {
datepickerInstances.push(new bulmaCalendar(datepicker, options));
});
return datepickerInstances;
}
}]);
return bulmaCalendar;
}(__WEBPACK_IMPORTED_MODULE_3__utils_events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaCalendar);
/***/ }),
/* 200 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return uuid; });
var uuid = function uuid() {
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return prefix + ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
});
};
/***/ }),
/* 201 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isString; });
/* unused harmony export isDate */
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var isString = function isString(unknown) {
return typeof unknown === 'string' || !!unknown && (typeof unknown === 'undefined' ? 'undefined' : _typeof(unknown)) === 'object' && Object.prototype.toString.call(unknown) === '[object String]';
};
var isDate = function isDate(unknown) {
return (Object.prototype.toString.call(unknown) === '[object Date]' || unknown instanceof Date) && !isNaN(unknown.valueOf());
};
/***/ }),
/* 202 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Range Helpers
* @summary Is the given date range overlapping with another date range?
*
* @description
* Is the given date range overlapping with another date range?
*
* @param {Date|String|Number} initialRangeStartDate - the start of the initial range
* @param {Date|String|Number} initialRangeEndDate - the end of the initial range
* @param {Date|String|Number} comparedRangeStartDate - the start of the range to compare it with
* @param {Date|String|Number} comparedRangeEndDate - the end of the range to compare it with
* @returns {Boolean} whether the date ranges are overlapping
* @throws {Error} startDate of a date range cannot be after its endDate
*
* @example
* // For overlapping date ranges:
* areRangesOverlapping(
* new Date(2014, 0, 10), new Date(2014, 0, 20), new Date(2014, 0, 17), new Date(2014, 0, 21)
* )
* //=> true
*
* @example
* // For non-overlapping date ranges:
* areRangesOverlapping(
* new Date(2014, 0, 10), new Date(2014, 0, 20), new Date(2014, 0, 21), new Date(2014, 0, 22)
* )
* //=> false
*/
function areRangesOverlapping (dirtyInitialRangeStartDate, dirtyInitialRangeEndDate, dirtyComparedRangeStartDate, dirtyComparedRangeEndDate) {
var initialStartTime = parse(dirtyInitialRangeStartDate).getTime()
var initialEndTime = parse(dirtyInitialRangeEndDate).getTime()
var comparedStartTime = parse(dirtyComparedRangeStartDate).getTime()
var comparedEndTime = parse(dirtyComparedRangeEndDate).getTime()
if (initialStartTime > initialEndTime || comparedStartTime > comparedEndTime) {
throw new Error('The start of the range cannot be after the end of the range')
}
return initialStartTime < comparedEndTime && comparedStartTime < initialEndTime
}
module.exports = areRangesOverlapping
/***/ }),
/* 203 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Return an index of the closest date from the array comparing to the given date.
*
* @description
* Return an index of the closest date from the array comparing to the given date.
*
* @param {Date|String|Number} dateToCompare - the date to compare with
* @param {Date[]|String[]|Number[]} datesArray - the array to search
* @returns {Number} an index of the date closest to the given date
* @throws {TypeError} the second argument must be an instance of Array
*
* @example
* // Which date is closer to 6 September 2015?
* var dateToCompare = new Date(2015, 8, 6)
* var datesArray = [
* new Date(2015, 0, 1),
* new Date(2016, 0, 1),
* new Date(2017, 0, 1)
* ]
* var result = closestIndexTo(dateToCompare, datesArray)
* //=> 1
*/
function closestIndexTo (dirtyDateToCompare, dirtyDatesArray) {
if (!(dirtyDatesArray instanceof Array)) {
throw new TypeError(toString.call(dirtyDatesArray) + ' is not an instance of Array')
}
var dateToCompare = parse(dirtyDateToCompare)
var timeToCompare = dateToCompare.getTime()
var result
var minDistance
dirtyDatesArray.forEach(function (dirtyDate, index) {
var currentDate = parse(dirtyDate)
var distance = Math.abs(timeToCompare - currentDate.getTime())
if (result === undefined || distance < minDistance) {
result = index
minDistance = distance
}
})
return result
}
module.exports = closestIndexTo
/***/ }),
/* 204 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Return a date from the array closest to the given date.
*
* @description
* Return a date from the array closest to the given date.
*
* @param {Date|String|Number} dateToCompare - the date to compare with
* @param {Date[]|String[]|Number[]} datesArray - the array to search
* @returns {Date} the date from the array closest to the given date
* @throws {TypeError} the second argument must be an instance of Array
*
* @example
* // Which date is closer to 6 September 2015: 1 January 2000 or 1 January 2030?
* var dateToCompare = new Date(2015, 8, 6)
* var result = closestTo(dateToCompare, [
* new Date(2000, 0, 1),
* new Date(2030, 0, 1)
* ])
* //=> Tue Jan 01 2030 00:00:00
*/
function closestTo (dirtyDateToCompare, dirtyDatesArray) {
if (!(dirtyDatesArray instanceof Array)) {
throw new TypeError(toString.call(dirtyDatesArray) + ' is not an instance of Array')
}
var dateToCompare = parse(dirtyDateToCompare)
var timeToCompare = dateToCompare.getTime()
var result
var minDistance
dirtyDatesArray.forEach(function (dirtyDate) {
var currentDate = parse(dirtyDate)
var distance = Math.abs(timeToCompare - currentDate.getTime())
if (result === undefined || distance < minDistance) {
result = currentDate
minDistance = distance
}
})
return result
}
module.exports = closestTo
/***/ }),
/* 205 */
/***/ (function(module, exports, __webpack_require__) {
var startOfISOWeek = __webpack_require__(3)
var MILLISECONDS_IN_MINUTE = 60000
var MILLISECONDS_IN_WEEK = 604800000
/**
* @category ISO Week Helpers
* @summary Get the number of calendar ISO weeks between the given dates.
*
* @description
* Get the number of calendar ISO weeks between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar ISO weeks
*
* @example
* // How many calendar ISO weeks are between 6 July 2014 and 21 July 2014?
* var result = differenceInCalendarISOWeeks(
* new Date(2014, 6, 21),
* new Date(2014, 6, 6)
* )
* //=> 3
*/
function differenceInCalendarISOWeeks (dirtyDateLeft, dirtyDateRight) {
var startOfISOWeekLeft = startOfISOWeek(dirtyDateLeft)
var startOfISOWeekRight = startOfISOWeek(dirtyDateRight)
var timestampLeft = startOfISOWeekLeft.getTime() -
startOfISOWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
var timestampRight = startOfISOWeekRight.getTime() -
startOfISOWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK)
}
module.exports = differenceInCalendarISOWeeks
/***/ }),
/* 206 */
/***/ (function(module, exports, __webpack_require__) {
var getQuarter = __webpack_require__(134)
var parse = __webpack_require__(0)
/**
* @category Quarter Helpers
* @summary Get the number of calendar quarters between the given dates.
*
* @description
* Get the number of calendar quarters between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of calendar quarters
*
* @example
* // How many calendar quarters are between 31 December 2013 and 2 July 2014?
* var result = differenceInCalendarQuarters(
* new Date(2014, 6, 2),
* new Date(2013, 11, 31)
* )
* //=> 3
*/
function differenceInCalendarQuarters (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var yearDiff = dateLeft.getFullYear() - dateRight.getFullYear()
var quarterDiff = getQuarter(dateLeft) - getQuarter(dateRight)
return yearDiff * 4 + quarterDiff
}
module.exports = differenceInCalendarQuarters
/***/ }),
/* 207 */
/***/ (function(module, exports, __webpack_require__) {
var startOfWeek = __webpack_require__(78)
var MILLISECONDS_IN_MINUTE = 60000
var MILLISECONDS_IN_WEEK = 604800000
/**
* @category Week Helpers
* @summary Get the number of calendar weeks between the given dates.
*
* @description
* Get the number of calendar weeks between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Number} the number of calendar weeks
*
* @example
* // How many calendar weeks are between 5 July 2014 and 20 July 2014?
* var result = differenceInCalendarWeeks(
* new Date(2014, 6, 20),
* new Date(2014, 6, 5)
* )
* //=> 3
*
* @example
* // If the week starts on Monday,
* // how many calendar weeks are between 5 July 2014 and 20 July 2014?
* var result = differenceInCalendarWeeks(
* new Date(2014, 6, 20),
* new Date(2014, 6, 5),
* {weekStartsOn: 1}
* )
* //=> 2
*/
function differenceInCalendarWeeks (dirtyDateLeft, dirtyDateRight, dirtyOptions) {
var startOfWeekLeft = startOfWeek(dirtyDateLeft, dirtyOptions)
var startOfWeekRight = startOfWeek(dirtyDateRight, dirtyOptions)
var timestampLeft = startOfWeekLeft.getTime() -
startOfWeekLeft.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
var timestampRight = startOfWeekRight.getTime() -
startOfWeekRight.getTimezoneOffset() * MILLISECONDS_IN_MINUTE
// Round the number of days to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round((timestampLeft - timestampRight) / MILLISECONDS_IN_WEEK)
}
module.exports = differenceInCalendarWeeks
/***/ }),
/* 208 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInMilliseconds = __webpack_require__(81)
var MILLISECONDS_IN_HOUR = 3600000
/**
* @category Hour Helpers
* @summary Get the number of hours between the given dates.
*
* @description
* Get the number of hours between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of hours
*
* @example
* // How many hours are between 2 July 2014 06:50:00 and 2 July 2014 19:00:00?
* var result = differenceInHours(
* new Date(2014, 6, 2, 19, 0),
* new Date(2014, 6, 2, 6, 50)
* )
* //=> 12
*/
function differenceInHours (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_HOUR
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInHours
/***/ }),
/* 209 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var differenceInCalendarISOYears = __webpack_require__(132)
var compareAsc = __webpack_require__(9)
var subISOYears = __webpack_require__(137)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Get the number of full ISO week-numbering years between the given dates.
*
* @description
* Get the number of full ISO week-numbering years between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full ISO week-numbering years
*
* @example
* // How many full ISO week-numbering years are between 1 January 2010 and 1 January 2012?
* var result = differenceInISOYears(
* new Date(2012, 0, 1),
* new Date(2010, 0, 1)
* )
* //=> 1
*/
function differenceInISOYears (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var sign = compareAsc(dateLeft, dateRight)
var difference = Math.abs(differenceInCalendarISOYears(dateLeft, dateRight))
dateLeft = subISOYears(dateLeft, sign * difference)
// Math.abs(diff in full ISO years - diff in calendar ISO years) === 1
// if last calendar ISO year is not full
// If so, result must be decreased by 1 in absolute value
var isLastISOYearNotFull = compareAsc(dateLeft, dateRight) === -sign
return sign * (difference - isLastISOYearNotFull)
}
module.exports = differenceInISOYears
/***/ }),
/* 210 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInMilliseconds = __webpack_require__(81)
var MILLISECONDS_IN_MINUTE = 60000
/**
* @category Minute Helpers
* @summary Get the number of minutes between the given dates.
*
* @description
* Get the number of minutes between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of minutes
*
* @example
* // How many minutes are between 2 July 2014 12:07:59 and 2 July 2014 12:20:00?
* var result = differenceInMinutes(
* new Date(2014, 6, 2, 12, 20, 0),
* new Date(2014, 6, 2, 12, 7, 59)
* )
* //=> 12
*/
function differenceInMinutes (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInMilliseconds(dirtyDateLeft, dirtyDateRight) / MILLISECONDS_IN_MINUTE
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInMinutes
/***/ }),
/* 211 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInMonths = __webpack_require__(119)
/**
* @category Quarter Helpers
* @summary Get the number of full quarters between the given dates.
*
* @description
* Get the number of full quarters between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full quarters
*
* @example
* // How many full quarters are between 31 December 2013 and 2 July 2014?
* var result = differenceInQuarters(
* new Date(2014, 6, 2),
* new Date(2013, 11, 31)
* )
* //=> 2
*/
function differenceInQuarters (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInMonths(dirtyDateLeft, dirtyDateRight) / 3
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInQuarters
/***/ }),
/* 212 */
/***/ (function(module, exports, __webpack_require__) {
var differenceInDays = __webpack_require__(136)
/**
* @category Week Helpers
* @summary Get the number of full weeks between the given dates.
*
* @description
* Get the number of full weeks between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full weeks
*
* @example
* // How many full weeks are between 5 July 2014 and 20 July 2014?
* var result = differenceInWeeks(
* new Date(2014, 6, 20),
* new Date(2014, 6, 5)
* )
* //=> 2
*/
function differenceInWeeks (dirtyDateLeft, dirtyDateRight) {
var diff = differenceInDays(dirtyDateLeft, dirtyDateRight) / 7
return diff > 0 ? Math.floor(diff) : Math.ceil(diff)
}
module.exports = differenceInWeeks
/***/ }),
/* 213 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var differenceInCalendarYears = __webpack_require__(135)
var compareAsc = __webpack_require__(9)
/**
* @category Year Helpers
* @summary Get the number of full years between the given dates.
*
* @description
* Get the number of full years between the given dates.
*
* @param {Date|String|Number} dateLeft - the later date
* @param {Date|String|Number} dateRight - the earlier date
* @returns {Number} the number of full years
*
* @example
* // How many full years are between 31 December 2013 and 11 February 2015?
* var result = differenceInYears(
* new Date(2015, 1, 11),
* new Date(2013, 11, 31)
* )
* //=> 1
*/
function differenceInYears (dirtyDateLeft, dirtyDateRight) {
var dateLeft = parse(dirtyDateLeft)
var dateRight = parse(dirtyDateRight)
var sign = compareAsc(dateLeft, dateRight)
var difference = Math.abs(differenceInCalendarYears(dateLeft, dateRight))
dateLeft.setFullYear(dateLeft.getFullYear() - sign * difference)
// Math.abs(diff in full years - diff in calendar years) === 1 if last calendar year is not full
// If so, result must be decreased by 1 in absolute value
var isLastYearNotFull = compareAsc(dateLeft, dateRight) === -sign
return sign * (difference - isLastYearNotFull)
}
module.exports = differenceInYears
/***/ }),
/* 214 */
/***/ (function(module, exports, __webpack_require__) {
var compareDesc = __webpack_require__(118)
var parse = __webpack_require__(0)
var differenceInSeconds = __webpack_require__(120)
var enLocale = __webpack_require__(5)
var MINUTES_IN_DAY = 1440
var MINUTES_IN_MONTH = 43200
var MINUTES_IN_YEAR = 525600
/**
* @category Common Helpers
* @summary Return the distance between the given dates in words.
*
* @description
* Return the distance between the given dates in words, using strict units.
* This is like `distanceInWords`, but does not use helpers like 'almost', 'over',
* 'less than' and the like.
*
* | Distance between dates | Result |
* |------------------------|---------------------|
* | 0 ... 59 secs | [0..59] seconds |
* | 1 ... 59 mins | [1..59] minutes |
* | 1 ... 23 hrs | [1..23] hours |
* | 1 ... 29 days | [1..29] days |
* | 1 ... 11 months | [1..11] months |
* | 1 ... N years | [1..N] years |
*
* @param {Date|String|Number} dateToCompare - the date to compare with
* @param {Date|String|Number} date - the other date
* @param {Object} [options] - the object with options
* @param {Boolean} [options.addSuffix=false] - result indicates if the second date is earlier or later than the first
* @param {'s'|'m'|'h'|'d'|'M'|'Y'} [options.unit] - if specified, will force a unit
* @param {'floor'|'ceil'|'round'} [options.partialMethod='floor'] - which way to round partial units
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the distance in words
*
* @example
* // What is the distance between 2 July 2014 and 1 January 2015?
* var result = distanceInWordsStrict(
* new Date(2014, 6, 2),
* new Date(2015, 0, 2)
* )
* //=> '6 months'
*
* @example
* // What is the distance between 1 January 2015 00:00:15
* // and 1 January 2015 00:00:00?
* var result = distanceInWordsStrict(
* new Date(2015, 0, 1, 0, 0, 15),
* new Date(2015, 0, 1, 0, 0, 0),
* )
* //=> '15 seconds'
*
* @example
* // What is the distance from 1 January 2016
* // to 1 January 2015, with a suffix?
* var result = distanceInWordsStrict(
* new Date(2016, 0, 1),
* new Date(2015, 0, 1),
* {addSuffix: true}
* )
* //=> '1 year ago'
*
* @example
* // What is the distance from 1 January 2016
* // to 1 January 2015, in minutes?
* var result = distanceInWordsStrict(
* new Date(2016, 0, 1),
* new Date(2015, 0, 1),
* {unit: 'm'}
* )
* //=> '525600 minutes'
*
* @example
* // What is the distance from 1 January 2016
* // to 28 January 2015, in months, rounded up?
* var result = distanceInWordsStrict(
* new Date(2015, 0, 28),
* new Date(2015, 0, 1),
* {unit: 'M', partialMethod: 'ceil'}
* )
* //=> '1 month'
*
* @example
* // What is the distance between 1 August 2016 and 1 January 2015 in Esperanto?
* var eoLocale = require('date-fns/locale/eo')
* var result = distanceInWordsStrict(
* new Date(2016, 7, 1),
* new Date(2015, 0, 1),
* {locale: eoLocale}
* )
* //=> '1 jaro'
*/
function distanceInWordsStrict (dirtyDateToCompare, dirtyDate, dirtyOptions) {
var options = dirtyOptions || {}
var comparison = compareDesc(dirtyDateToCompare, dirtyDate)
var locale = options.locale
var localize = enLocale.distanceInWords.localize
if (locale && locale.distanceInWords && locale.distanceInWords.localize) {
localize = locale.distanceInWords.localize
}
var localizeOptions = {
addSuffix: Boolean(options.addSuffix),
comparison: comparison
}
var dateLeft, dateRight
if (comparison > 0) {
dateLeft = parse(dirtyDateToCompare)
dateRight = parse(dirtyDate)
} else {
dateLeft = parse(dirtyDate)
dateRight = parse(dirtyDateToCompare)
}
var unit
var mathPartial = Math[options.partialMethod ? String(options.partialMethod) : 'floor']
var seconds = differenceInSeconds(dateRight, dateLeft)
var offset = dateRight.getTimezoneOffset() - dateLeft.getTimezoneOffset()
var minutes = mathPartial(seconds / 60) - offset
var hours, days, months, years
if (options.unit) {
unit = String(options.unit)
} else {
if (minutes < 1) {
unit = 's'
} else if (minutes < 60) {
unit = 'm'
} else if (minutes < MINUTES_IN_DAY) {
unit = 'h'
} else if (minutes < MINUTES_IN_MONTH) {
unit = 'd'
} else if (minutes < MINUTES_IN_YEAR) {
unit = 'M'
} else {
unit = 'Y'
}
}
// 0 up to 60 seconds
if (unit === 's') {
return localize('xSeconds', seconds, localizeOptions)
// 1 up to 60 mins
} else if (unit === 'm') {
return localize('xMinutes', minutes, localizeOptions)
// 1 up to 24 hours
} else if (unit === 'h') {
hours = mathPartial(minutes / 60)
return localize('xHours', hours, localizeOptions)
// 1 up to 30 days
} else if (unit === 'd') {
days = mathPartial(minutes / MINUTES_IN_DAY)
return localize('xDays', days, localizeOptions)
// 1 up to 12 months
} else if (unit === 'M') {
months = mathPartial(minutes / MINUTES_IN_MONTH)
return localize('xMonths', months, localizeOptions)
// 1 year up to max Date
} else if (unit === 'Y') {
years = mathPartial(minutes / MINUTES_IN_YEAR)
return localize('xYears', years, localizeOptions)
}
throw new Error('Unknown unit: ' + unit)
}
module.exports = distanceInWordsStrict
/***/ }),
/* 215 */
/***/ (function(module, exports, __webpack_require__) {
var distanceInWords = __webpack_require__(138)
/**
* @category Common Helpers
* @summary Return the distance between the given date and now in words.
*
* @description
* Return the distance between the given date and now in words.
*
* | Distance to now | Result |
* |-------------------------------------------------------------------|---------------------|
* | 0 ... 30 secs | less than a minute |
* | 30 secs ... 1 min 30 secs | 1 minute |
* | 1 min 30 secs ... 44 mins 30 secs | [2..44] minutes |
* | 44 mins ... 30 secs ... 89 mins 30 secs | about 1 hour |
* | 89 mins 30 secs ... 23 hrs 59 mins 30 secs | about [2..24] hours |
* | 23 hrs 59 mins 30 secs ... 41 hrs 59 mins 30 secs | 1 day |
* | 41 hrs 59 mins 30 secs ... 29 days 23 hrs 59 mins 30 secs | [2..30] days |
* | 29 days 23 hrs 59 mins 30 secs ... 44 days 23 hrs 59 mins 30 secs | about 1 month |
* | 44 days 23 hrs 59 mins 30 secs ... 59 days 23 hrs 59 mins 30 secs | about 2 months |
* | 59 days 23 hrs 59 mins 30 secs ... 1 yr | [2..12] months |
* | 1 yr ... 1 yr 3 months | about 1 year |
* | 1 yr 3 months ... 1 yr 9 month s | over 1 year |
* | 1 yr 9 months ... 2 yrs | almost 2 years |
* | N yrs ... N yrs 3 months | about N years |
* | N yrs 3 months ... N yrs 9 months | over N years |
* | N yrs 9 months ... N+1 yrs | almost N+1 years |
*
* With `options.includeSeconds == true`:
* | Distance to now | Result |
* |---------------------|----------------------|
* | 0 secs ... 5 secs | less than 5 seconds |
* | 5 secs ... 10 secs | less than 10 seconds |
* | 10 secs ... 20 secs | less than 20 seconds |
* | 20 secs ... 40 secs | half a minute |
* | 40 secs ... 60 secs | less than a minute |
* | 60 secs ... 90 secs | 1 minute |
*
* @param {Date|String|Number} date - the given date
* @param {Object} [options] - the object with options
* @param {Boolean} [options.includeSeconds=false] - distances less than a minute are more detailed
* @param {Boolean} [options.addSuffix=false] - result specifies if the second date is earlier or later than the first
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the distance in words
*
* @example
* // If today is 1 January 2015, what is the distance to 2 July 2014?
* var result = distanceInWordsToNow(
* new Date(2014, 6, 2)
* )
* //=> '6 months'
*
* @example
* // If now is 1 January 2015 00:00:00,
* // what is the distance to 1 January 2015 00:00:15, including seconds?
* var result = distanceInWordsToNow(
* new Date(2015, 0, 1, 0, 0, 15),
* {includeSeconds: true}
* )
* //=> 'less than 20 seconds'
*
* @example
* // If today is 1 January 2015,
* // what is the distance to 1 January 2016, with a suffix?
* var result = distanceInWordsToNow(
* new Date(2016, 0, 1),
* {addSuffix: true}
* )
* //=> 'in about 1 year'
*
* @example
* // If today is 1 January 2015,
* // what is the distance to 1 August 2016 in Esperanto?
* var eoLocale = require('date-fns/locale/eo')
* var result = distanceInWordsToNow(
* new Date(2016, 7, 1),
* {locale: eoLocale}
* )
* //=> 'pli ol 1 jaro'
*/
function distanceInWordsToNow (dirtyDate, dirtyOptions) {
return distanceInWords(Date.now(), dirtyDate, dirtyOptions)
}
module.exports = distanceInWordsToNow
/***/ }),
/* 216 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Return the array of dates within the specified range.
*
* @description
* Return the array of dates within the specified range.
*
* @param {Date|String|Number} startDate - the first date
* @param {Date|String|Number} endDate - the last date
* @param {Number} [step=1] - the step between each day
* @returns {Date[]} the array with starts of days from the day of startDate to the day of endDate
* @throws {Error} startDate cannot be after endDate
*
* @example
* // Each day between 6 October 2014 and 10 October 2014:
* var result = eachDay(
* new Date(2014, 9, 6),
* new Date(2014, 9, 10)
* )
* //=> [
* // Mon Oct 06 2014 00:00:00,
* // Tue Oct 07 2014 00:00:00,
* // Wed Oct 08 2014 00:00:00,
* // Thu Oct 09 2014 00:00:00,
* // Fri Oct 10 2014 00:00:00
* // ]
*/
function eachDay (dirtyStartDate, dirtyEndDate, dirtyStep) {
var startDate = parse(dirtyStartDate)
var endDate = parse(dirtyEndDate)
var step = dirtyStep !== undefined ? dirtyStep : 1
var endTime = endDate.getTime()
if (startDate.getTime() > endTime) {
throw new Error('The first date cannot be after the second date')
}
var dates = []
var currentDate = startDate
currentDate.setHours(0, 0, 0, 0)
while (currentDate.getTime() <= endTime) {
dates.push(parse(currentDate))
currentDate.setDate(currentDate.getDate() + step)
}
return dates
}
module.exports = eachDay
/***/ }),
/* 217 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Hour Helpers
* @summary Return the end of an hour for the given date.
*
* @description
* Return the end of an hour for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of an hour
*
* @example
* // The end of an hour for 2 September 2014 11:55:00:
* var result = endOfHour(new Date(2014, 8, 2, 11, 55))
* //=> Tue Sep 02 2014 11:59:59.999
*/
function endOfHour (dirtyDate) {
var date = parse(dirtyDate)
date.setMinutes(59, 59, 999)
return date
}
module.exports = endOfHour
/***/ }),
/* 218 */
/***/ (function(module, exports, __webpack_require__) {
var endOfWeek = __webpack_require__(139)
/**
* @category ISO Week Helpers
* @summary Return the end of an ISO week for the given date.
*
* @description
* Return the end of an ISO week for the given date.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of an ISO week
*
* @example
* // The end of an ISO week for 2 September 2014 11:55:00:
* var result = endOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Sep 07 2014 23:59:59.999
*/
function endOfISOWeek (dirtyDate) {
return endOfWeek(dirtyDate, {weekStartsOn: 1})
}
module.exports = endOfISOWeek
/***/ }),
/* 219 */
/***/ (function(module, exports, __webpack_require__) {
var getISOYear = __webpack_require__(2)
var startOfISOWeek = __webpack_require__(3)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Return the end of an ISO week-numbering year for the given date.
*
* @description
* Return the end of an ISO week-numbering year,
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of an ISO week-numbering year
*
* @example
* // The end of an ISO week-numbering year for 2 July 2005:
* var result = endOfISOYear(new Date(2005, 6, 2))
* //=> Sun Jan 01 2006 23:59:59.999
*/
function endOfISOYear (dirtyDate) {
var year = getISOYear(dirtyDate)
var fourthOfJanuaryOfNextYear = new Date(0)
fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4)
fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0)
var date = startOfISOWeek(fourthOfJanuaryOfNextYear)
date.setMilliseconds(date.getMilliseconds() - 1)
return date
}
module.exports = endOfISOYear
/***/ }),
/* 220 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Minute Helpers
* @summary Return the end of a minute for the given date.
*
* @description
* Return the end of a minute for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a minute
*
* @example
* // The end of a minute for 1 December 2014 22:15:45.400:
* var result = endOfMinute(new Date(2014, 11, 1, 22, 15, 45, 400))
* //=> Mon Dec 01 2014 22:15:59.999
*/
function endOfMinute (dirtyDate) {
var date = parse(dirtyDate)
date.setSeconds(59, 999)
return date
}
module.exports = endOfMinute
/***/ }),
/* 221 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Quarter Helpers
* @summary Return the end of a year quarter for the given date.
*
* @description
* Return the end of a year quarter for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a quarter
*
* @example
* // The end of a quarter for 2 September 2014 11:55:00:
* var result = endOfQuarter(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 23:59:59.999
*/
function endOfQuarter (dirtyDate) {
var date = parse(dirtyDate)
var currentMonth = date.getMonth()
var month = currentMonth - currentMonth % 3 + 3
date.setMonth(month, 0)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfQuarter
/***/ }),
/* 222 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Second Helpers
* @summary Return the end of a second for the given date.
*
* @description
* Return the end of a second for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a second
*
* @example
* // The end of a second for 1 December 2014 22:15:45.400:
* var result = endOfSecond(new Date(2014, 11, 1, 22, 15, 45, 400))
* //=> Mon Dec 01 2014 22:15:45.999
*/
function endOfSecond (dirtyDate) {
var date = parse(dirtyDate)
date.setMilliseconds(999)
return date
}
module.exports = endOfSecond
/***/ }),
/* 223 */
/***/ (function(module, exports, __webpack_require__) {
var endOfDay = __webpack_require__(121)
/**
* @category Day Helpers
* @summary Return the end of today.
*
* @description
* Return the end of today.
*
* @returns {Date} the end of today
*
* @example
* // If today is 6 October 2014:
* var result = endOfToday()
* //=> Mon Oct 6 2014 23:59:59.999
*/
function endOfToday () {
return endOfDay(new Date())
}
module.exports = endOfToday
/***/ }),
/* 224 */
/***/ (function(module, exports) {
/**
* @category Day Helpers
* @summary Return the end of tomorrow.
*
* @description
* Return the end of tomorrow.
*
* @returns {Date} the end of tomorrow
*
* @example
* // If today is 6 October 2014:
* var result = endOfTomorrow()
* //=> Tue Oct 7 2014 23:59:59.999
*/
function endOfTomorrow () {
var now = new Date()
var year = now.getFullYear()
var month = now.getMonth()
var day = now.getDate()
var date = new Date(0)
date.setFullYear(year, month, day + 1)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfTomorrow
/***/ }),
/* 225 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Return the end of a year for the given date.
*
* @description
* Return the end of a year for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of a year
*
* @example
* // The end of a year for 2 September 2014 11:55:00:
* var result = endOfYear(new Date(2014, 8, 2, 11, 55, 00))
* //=> Wed Dec 31 2014 23:59:59.999
*/
function endOfYear (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
date.setFullYear(year + 1, 0, 0)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfYear
/***/ }),
/* 226 */
/***/ (function(module, exports) {
/**
* @category Day Helpers
* @summary Return the end of yesterday.
*
* @description
* Return the end of yesterday.
*
* @returns {Date} the end of yesterday
*
* @example
* // If today is 6 October 2014:
* var result = endOfYesterday()
* //=> Sun Oct 5 2014 23:59:59.999
*/
function endOfYesterday () {
var now = new Date()
var year = now.getFullYear()
var month = now.getMonth()
var day = now.getDate()
var date = new Date(0)
date.setFullYear(year, month, day - 1)
date.setHours(23, 59, 59, 999)
return date
}
module.exports = endOfYesterday
/***/ }),
/* 227 */
/***/ (function(module, exports, __webpack_require__) {
var getDayOfYear = __webpack_require__(141)
var getISOWeek = __webpack_require__(122)
var getISOYear = __webpack_require__(2)
var parse = __webpack_require__(0)
var isValid = __webpack_require__(143)
var enLocale = __webpack_require__(5)
/**
* @category Common Helpers
* @summary Format the date.
*
* @description
* Return the formatted date string in the given format.
*
* Accepted tokens:
* | Unit | Token | Result examples |
* |-------------------------|-------|----------------------------------|
* | Month | M | 1, 2, ..., 12 |
* | | Mo | 1st, 2nd, ..., 12th |
* | | MM | 01, 02, ..., 12 |
* | | MMM | Jan, Feb, ..., Dec |
* | | MMMM | January, February, ..., December |
* | Quarter | Q | 1, 2, 3, 4 |
* | | Qo | 1st, 2nd, 3rd, 4th |
* | Day of month | D | 1, 2, ..., 31 |
* | | Do | 1st, 2nd, ..., 31st |
* | | DD | 01, 02, ..., 31 |
* | Day of year | DDD | 1, 2, ..., 366 |
* | | DDDo | 1st, 2nd, ..., 366th |
* | | DDDD | 001, 002, ..., 366 |
* | Day of week | d | 0, 1, ..., 6 |
* | | do | 0th, 1st, ..., 6th |
* | | dd | Su, Mo, ..., Sa |
* | | ddd | Sun, Mon, ..., Sat |
* | | dddd | Sunday, Monday, ..., Saturday |
* | Day of ISO week | E | 1, 2, ..., 7 |
* | ISO week | W | 1, 2, ..., 53 |
* | | Wo | 1st, 2nd, ..., 53rd |
* | | WW | 01, 02, ..., 53 |
* | Year | YY | 00, 01, ..., 99 |
* | | YYYY | 1900, 1901, ..., 2099 |
* | ISO week-numbering year | GG | 00, 01, ..., 99 |
* | | GGGG | 1900, 1901, ..., 2099 |
* | AM/PM | A | AM, PM |
* | | a | am, pm |
* | | aa | a.m., p.m. |
* | Hour | H | 0, 1, ... 23 |
* | | HH | 00, 01, ... 23 |
* | | h | 1, 2, ..., 12 |
* | | hh | 01, 02, ..., 12 |
* | Minute | m | 0, 1, ..., 59 |
* | | mm | 00, 01, ..., 59 |
* | Second | s | 0, 1, ..., 59 |
* | | ss | 00, 01, ..., 59 |
* | 1/10 of second | S | 0, 1, ..., 9 |
* | 1/100 of second | SS | 00, 01, ..., 99 |
* | Millisecond | SSS | 000, 001, ..., 999 |
* | Timezone | Z | -01:00, +00:00, ... +12:00 |
* | | ZZ | -0100, +0000, ..., +1200 |
* | Seconds timestamp | X | 512969520 |
* | Milliseconds timestamp | x | 512969520900 |
*
* The characters wrapped in square brackets are escaped.
*
* The result may vary by locale.
*
* @param {Date|String|Number} date - the original date
* @param {String} [format='YYYY-MM-DDTHH:mm:ss.SSSZ'] - the string of tokens
* @param {Object} [options] - the object with options
* @param {Object} [options.locale=enLocale] - the locale object
* @returns {String} the formatted date string
*
* @example
* // Represent 11 February 2014 in middle-endian format:
* var result = format(
* new Date(2014, 1, 11),
* 'MM/DD/YYYY'
* )
* //=> '02/11/2014'
*
* @example
* // Represent 2 July 2014 in Esperanto:
* var eoLocale = require('date-fns/locale/eo')
* var result = format(
* new Date(2014, 6, 2),
* 'Do [de] MMMM YYYY',
* {locale: eoLocale}
* )
* //=> '2-a de julio 2014'
*/
function format (dirtyDate, dirtyFormatStr, dirtyOptions) {
var formatStr = dirtyFormatStr ? String(dirtyFormatStr) : 'YYYY-MM-DDTHH:mm:ss.SSSZ'
var options = dirtyOptions || {}
var locale = options.locale
var localeFormatters = enLocale.format.formatters
var formattingTokensRegExp = enLocale.format.formattingTokensRegExp
if (locale && locale.format && locale.format.formatters) {
localeFormatters = locale.format.formatters
if (locale.format.formattingTokensRegExp) {
formattingTokensRegExp = locale.format.formattingTokensRegExp
}
}
var date = parse(dirtyDate)
if (!isValid(date)) {
return 'Invalid Date'
}
var formatFn = buildFormatFn(formatStr, localeFormatters, formattingTokensRegExp)
return formatFn(date)
}
var formatters = {
// Month: 1, 2, ..., 12
'M': function (date) {
return date.getMonth() + 1
},
// Month: 01, 02, ..., 12
'MM': function (date) {
return addLeadingZeros(date.getMonth() + 1, 2)
},
// Quarter: 1, 2, 3, 4
'Q': function (date) {
return Math.ceil((date.getMonth() + 1) / 3)
},
// Day of month: 1, 2, ..., 31
'D': function (date) {
return date.getDate()
},
// Day of month: 01, 02, ..., 31
'DD': function (date) {
return addLeadingZeros(date.getDate(), 2)
},
// Day of year: 1, 2, ..., 366
'DDD': function (date) {
return getDayOfYear(date)
},
// Day of year: 001, 002, ..., 366
'DDDD': function (date) {
return addLeadingZeros(getDayOfYear(date), 3)
},
// Day of week: 0, 1, ..., 6
'd': function (date) {
return date.getDay()
},
// Day of ISO week: 1, 2, ..., 7
'E': function (date) {
return date.getDay() || 7
},
// ISO week: 1, 2, ..., 53
'W': function (date) {
return getISOWeek(date)
},
// ISO week: 01, 02, ..., 53
'WW': function (date) {
return addLeadingZeros(getISOWeek(date), 2)
},
// Year: 00, 01, ..., 99
'YY': function (date) {
return addLeadingZeros(date.getFullYear(), 4).substr(2)
},
// Year: 1900, 1901, ..., 2099
'YYYY': function (date) {
return addLeadingZeros(date.getFullYear(), 4)
},
// ISO week-numbering year: 00, 01, ..., 99
'GG': function (date) {
return String(getISOYear(date)).substr(2)
},
// ISO week-numbering year: 1900, 1901, ..., 2099
'GGGG': function (date) {
return getISOYear(date)
},
// Hour: 0, 1, ... 23
'H': function (date) {
return date.getHours()
},
// Hour: 00, 01, ..., 23
'HH': function (date) {
return addLeadingZeros(date.getHours(), 2)
},
// Hour: 1, 2, ..., 12
'h': function (date) {
var hours = date.getHours()
if (hours === 0) {
return 12
} else if (hours > 12) {
return hours % 12
} else {
return hours
}
},
// Hour: 01, 02, ..., 12
'hh': function (date) {
return addLeadingZeros(formatters['h'](date), 2)
},
// Minute: 0, 1, ..., 59
'm': function (date) {
return date.getMinutes()
},
// Minute: 00, 01, ..., 59
'mm': function (date) {
return addLeadingZeros(date.getMinutes(), 2)
},
// Second: 0, 1, ..., 59
's': function (date) {
return date.getSeconds()
},
// Second: 00, 01, ..., 59
'ss': function (date) {
return addLeadingZeros(date.getSeconds(), 2)
},
// 1/10 of second: 0, 1, ..., 9
'S': function (date) {
return Math.floor(date.getMilliseconds() / 100)
},
// 1/100 of second: 00, 01, ..., 99
'SS': function (date) {
return addLeadingZeros(Math.floor(date.getMilliseconds() / 10), 2)
},
// Millisecond: 000, 001, ..., 999
'SSS': function (date) {
return addLeadingZeros(date.getMilliseconds(), 3)
},
// Timezone: -01:00, +00:00, ... +12:00
'Z': function (date) {
return formatTimezone(date.getTimezoneOffset(), ':')
},
// Timezone: -0100, +0000, ... +1200
'ZZ': function (date) {
return formatTimezone(date.getTimezoneOffset())
},
// Seconds timestamp: 512969520
'X': function (date) {
return Math.floor(date.getTime() / 1000)
},
// Milliseconds timestamp: 512969520900
'x': function (date) {
return date.getTime()
}
}
function buildFormatFn (formatStr, localeFormatters, formattingTokensRegExp) {
var array = formatStr.match(formattingTokensRegExp)
var length = array.length
var i
var formatter
for (i = 0; i < length; i++) {
formatter = localeFormatters[array[i]] || formatters[array[i]]
if (formatter) {
array[i] = formatter
} else {
array[i] = removeFormattingTokens(array[i])
}
}
return function (date) {
var output = ''
for (var i = 0; i < length; i++) {
if (array[i] instanceof Function) {
output += array[i](date, formatters)
} else {
output += array[i]
}
}
return output
}
}
function removeFormattingTokens (input) {
if (input.match(/\[[\s\S]/)) {
return input.replace(/^\[|]$/g, '')
}
return input.replace(/\\/g, '')
}
function formatTimezone (offset, delimeter) {
delimeter = delimeter || ''
var sign = offset > 0 ? '-' : '+'
var absOffset = Math.abs(offset)
var hours = Math.floor(absOffset / 60)
var minutes = absOffset % 60
return sign + addLeadingZeros(hours, 2) + delimeter + addLeadingZeros(minutes, 2)
}
function addLeadingZeros (number, targetLength) {
var output = Math.abs(number).toString()
while (output.length < targetLength) {
output = '0' + output
}
return output
}
module.exports = format
/***/ }),
/* 228 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Get the day of the month of the given date.
*
* @description
* Get the day of the month of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the day of month
*
* @example
* // Which day of the month is 29 February 2012?
* var result = getDate(new Date(2012, 1, 29))
* //=> 29
*/
function getDate (dirtyDate) {
var date = parse(dirtyDate)
var dayOfMonth = date.getDate()
return dayOfMonth
}
module.exports = getDate
/***/ }),
/* 229 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Get the day of the week of the given date.
*
* @description
* Get the day of the week of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the day of week
*
* @example
* // Which day of the week is 29 February 2012?
* var result = getDay(new Date(2012, 1, 29))
* //=> 3
*/
function getDay (dirtyDate) {
var date = parse(dirtyDate)
var day = date.getDay()
return day
}
module.exports = getDay
/***/ }),
/* 230 */
/***/ (function(module, exports, __webpack_require__) {
var isLeapYear = __webpack_require__(144)
/**
* @category Year Helpers
* @summary Get the number of days in a year of the given date.
*
* @description
* Get the number of days in a year of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the number of days in a year
*
* @example
* // How many days are in 2012?
* var result = getDaysInYear(new Date(2012, 0, 1))
* //=> 366
*/
function getDaysInYear (dirtyDate) {
return isLeapYear(dirtyDate) ? 366 : 365
}
module.exports = getDaysInYear
/***/ }),
/* 231 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Hour Helpers
* @summary Get the hours of the given date.
*
* @description
* Get the hours of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the hours
*
* @example
* // Get the hours of 29 February 2012 11:45:00:
* var result = getHours(new Date(2012, 1, 29, 11, 45))
* //=> 11
*/
function getHours (dirtyDate) {
var date = parse(dirtyDate)
var hours = date.getHours()
return hours
}
module.exports = getHours
/***/ }),
/* 232 */
/***/ (function(module, exports, __webpack_require__) {
var startOfISOYear = __webpack_require__(8)
var addWeeks = __webpack_require__(117)
var MILLISECONDS_IN_WEEK = 604800000
/**
* @category ISO Week-Numbering Year Helpers
* @summary Get the number of weeks in an ISO week-numbering year of the given date.
*
* @description
* Get the number of weeks in an ISO week-numbering year of the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the number of ISO weeks in a year
*
* @example
* // How many weeks are in ISO week-numbering year 2015?
* var result = getISOWeeksInYear(new Date(2015, 1, 11))
* //=> 53
*/
function getISOWeeksInYear (dirtyDate) {
var thisYear = startOfISOYear(dirtyDate)
var nextYear = startOfISOYear(addWeeks(thisYear, 60))
var diff = nextYear.valueOf() - thisYear.valueOf()
// Round the number of weeks to the nearest integer
// because the number of milliseconds in a week is not constant
// (e.g. it's different in the week of the daylight saving time clock shift)
return Math.round(diff / MILLISECONDS_IN_WEEK)
}
module.exports = getISOWeeksInYear
/***/ }),
/* 233 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Millisecond Helpers
* @summary Get the milliseconds of the given date.
*
* @description
* Get the milliseconds of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the milliseconds
*
* @example
* // Get the milliseconds of 29 February 2012 11:45:05.123:
* var result = getMilliseconds(new Date(2012, 1, 29, 11, 45, 5, 123))
* //=> 123
*/
function getMilliseconds (dirtyDate) {
var date = parse(dirtyDate)
var milliseconds = date.getMilliseconds()
return milliseconds
}
module.exports = getMilliseconds
/***/ }),
/* 234 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Minute Helpers
* @summary Get the minutes of the given date.
*
* @description
* Get the minutes of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the minutes
*
* @example
* // Get the minutes of 29 February 2012 11:45:05:
* var result = getMinutes(new Date(2012, 1, 29, 11, 45, 5))
* //=> 45
*/
function getMinutes (dirtyDate) {
var date = parse(dirtyDate)
var minutes = date.getMinutes()
return minutes
}
module.exports = getMinutes
/***/ }),
/* 235 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Get the month of the given date.
*
* @description
* Get the month of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the month
*
* @example
* // Which month is 29 February 2012?
* var result = getMonth(new Date(2012, 1, 29))
* //=> 1
*/
function getMonth (dirtyDate) {
var date = parse(dirtyDate)
var month = date.getMonth()
return month
}
module.exports = getMonth
/***/ }),
/* 236 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var MILLISECONDS_IN_DAY = 24 * 60 * 60 * 1000
/**
* @category Range Helpers
* @summary Get the number of days that overlap in two date ranges
*
* @description
* Get the number of days that overlap in two date ranges
*
* @param {Date|String|Number} initialRangeStartDate - the start of the initial range
* @param {Date|String|Number} initialRangeEndDate - the end of the initial range
* @param {Date|String|Number} comparedRangeStartDate - the start of the range to compare it with
* @param {Date|String|Number} comparedRangeEndDate - the end of the range to compare it with
* @returns {Number} the number of days that overlap in two date ranges
* @throws {Error} startDate of a date range cannot be after its endDate
*
* @example
* // For overlapping date ranges adds 1 for each started overlapping day:
* getOverlappingDaysInRanges(
* new Date(2014, 0, 10), new Date(2014, 0, 20), new Date(2014, 0, 17), new Date(2014, 0, 21)
* )
* //=> 3
*
* @example
* // For non-overlapping date ranges returns 0:
* getOverlappingDaysInRanges(
* new Date(2014, 0, 10), new Date(2014, 0, 20), new Date(2014, 0, 21), new Date(2014, 0, 22)
* )
* //=> 0
*/
function getOverlappingDaysInRanges (dirtyInitialRangeStartDate, dirtyInitialRangeEndDate, dirtyComparedRangeStartDate, dirtyComparedRangeEndDate) {
var initialStartTime = parse(dirtyInitialRangeStartDate).getTime()
var initialEndTime = parse(dirtyInitialRangeEndDate).getTime()
var comparedStartTime = parse(dirtyComparedRangeStartDate).getTime()
var comparedEndTime = parse(dirtyComparedRangeEndDate).getTime()
if (initialStartTime > initialEndTime || comparedStartTime > comparedEndTime) {
throw new Error('The start of the range cannot be after the end of the range')
}
var isOverlapping = initialStartTime < comparedEndTime && comparedStartTime < initialEndTime
if (!isOverlapping) {
return 0
}
var overlapStartDate = comparedStartTime < initialStartTime
? initialStartTime
: comparedStartTime
var overlapEndDate = comparedEndTime > initialEndTime
? initialEndTime
: comparedEndTime
var differenceInMs = overlapEndDate - overlapStartDate
return Math.ceil(differenceInMs / MILLISECONDS_IN_DAY)
}
module.exports = getOverlappingDaysInRanges
/***/ }),
/* 237 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Second Helpers
* @summary Get the seconds of the given date.
*
* @description
* Get the seconds of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the seconds
*
* @example
* // Get the seconds of 29 February 2012 11:45:05.123:
* var result = getSeconds(new Date(2012, 1, 29, 11, 45, 5, 123))
* //=> 5
*/
function getSeconds (dirtyDate) {
var date = parse(dirtyDate)
var seconds = date.getSeconds()
return seconds
}
module.exports = getSeconds
/***/ }),
/* 238 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Timestamp Helpers
* @summary Get the milliseconds timestamp of the given date.
*
* @description
* Get the milliseconds timestamp of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the timestamp
*
* @example
* // Get the timestamp of 29 February 2012 11:45:05.123:
* var result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))
* //=> 1330515905123
*/
function getTime (dirtyDate) {
var date = parse(dirtyDate)
var timestamp = date.getTime()
return timestamp
}
module.exports = getTime
/***/ }),
/* 239 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Get the year of the given date.
*
* @description
* Get the year of the given date.
*
* @param {Date|String|Number} date - the given date
* @returns {Number} the year
*
* @example
* // Which year is 2 July 2014?
* var result = getYear(new Date(2014, 6, 2))
* //=> 2014
*/
function getYear (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
return year
}
module.exports = getYear
/***/ }),
/* 240 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Is the first date after the second one?
*
* @description
* Is the first date after the second one?
*
* @param {Date|String|Number} date - the date that should be after the other one to return true
* @param {Date|String|Number} dateToCompare - the date to compare with
* @returns {Boolean} the first date is after the second date
*
* @example
* // Is 10 July 1989 after 11 February 1987?
* var result = isAfter(new Date(1989, 6, 10), new Date(1987, 1, 11))
* //=> true
*/
function isAfter (dirtyDate, dirtyDateToCompare) {
var date = parse(dirtyDate)
var dateToCompare = parse(dirtyDateToCompare)
return date.getTime() > dateToCompare.getTime()
}
module.exports = isAfter
/***/ }),
/* 241 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Is the first date before the second one?
*
* @description
* Is the first date before the second one?
*
* @param {Date|String|Number} date - the date that should be before the other one to return true
* @param {Date|String|Number} dateToCompare - the date to compare with
* @returns {Boolean} the first date is before the second date
*
* @example
* // Is 10 July 1989 before 11 February 1987?
* var result = isBefore(new Date(1989, 6, 10), new Date(1987, 1, 11))
* //=> false
*/
function isBefore (dirtyDate, dirtyDateToCompare) {
var date = parse(dirtyDate)
var dateToCompare = parse(dirtyDateToCompare)
return date.getTime() < dateToCompare.getTime()
}
module.exports = isBefore
/***/ }),
/* 242 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Are the given dates equal?
*
* @description
* Are the given dates equal?
*
* @param {Date|String|Number} dateLeft - the first date to compare
* @param {Date|String|Number} dateRight - the second date to compare
* @returns {Boolean} the dates are equal
*
* @example
* // Are 2 July 2014 06:30:45.000 and 2 July 2014 06:30:45.500 equal?
* var result = isEqual(
* new Date(2014, 6, 2, 6, 30, 45, 0)
* new Date(2014, 6, 2, 6, 30, 45, 500)
* )
* //=> false
*/
function isEqual (dirtyLeftDate, dirtyRightDate) {
var dateLeft = parse(dirtyLeftDate)
var dateRight = parse(dirtyRightDate)
return dateLeft.getTime() === dateRight.getTime()
}
module.exports = isEqual
/***/ }),
/* 243 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Is the given date the first day of a month?
*
* @description
* Is the given date the first day of a month?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is the first day of a month
*
* @example
* // Is 1 September 2014 the first day of a month?
* var result = isFirstDayOfMonth(new Date(2014, 8, 1))
* //=> true
*/
function isFirstDayOfMonth (dirtyDate) {
return parse(dirtyDate).getDate() === 1
}
module.exports = isFirstDayOfMonth
/***/ }),
/* 244 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Friday?
*
* @description
* Is the given date Friday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Friday
*
* @example
* // Is 26 September 2014 Friday?
* var result = isFriday(new Date(2014, 8, 26))
* //=> true
*/
function isFriday (dirtyDate) {
return parse(dirtyDate).getDay() === 5
}
module.exports = isFriday
/***/ }),
/* 245 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Is the given date in the future?
*
* @description
* Is the given date in the future?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in the future
*
* @example
* // If today is 6 October 2014, is 31 December 2014 in the future?
* var result = isFuture(new Date(2014, 11, 31))
* //=> true
*/
function isFuture (dirtyDate) {
return parse(dirtyDate).getTime() > new Date().getTime()
}
module.exports = isFuture
/***/ }),
/* 246 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var endOfDay = __webpack_require__(121)
var endOfMonth = __webpack_require__(140)
/**
* @category Month Helpers
* @summary Is the given date the last day of a month?
*
* @description
* Is the given date the last day of a month?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is the last day of a month
*
* @example
* // Is 28 February 2014 the last day of a month?
* var result = isLastDayOfMonth(new Date(2014, 1, 28))
* //=> true
*/
function isLastDayOfMonth (dirtyDate) {
var date = parse(dirtyDate)
return endOfDay(date).getTime() === endOfMonth(date).getTime()
}
module.exports = isLastDayOfMonth
/***/ }),
/* 247 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Monday?
*
* @description
* Is the given date Monday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Monday
*
* @example
* // Is 22 September 2014 Monday?
* var result = isMonday(new Date(2014, 8, 22))
* //=> true
*/
function isMonday (dirtyDate) {
return parse(dirtyDate).getDay() === 1
}
module.exports = isMonday
/***/ }),
/* 248 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Is the given date in the past?
*
* @description
* Is the given date in the past?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in the past
*
* @example
* // If today is 6 October 2014, is 2 July 2014 in the past?
* var result = isPast(new Date(2014, 6, 2))
* //=> true
*/
function isPast (dirtyDate) {
return parse(dirtyDate).getTime() < new Date().getTime()
}
module.exports = isPast
/***/ }),
/* 249 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
/**
* @category Day Helpers
* @summary Are the given dates in the same day?
*
* @description
* Are the given dates in the same day?
*
* @param {Date|String|Number} dateLeft - the first date to check
* @param {Date|String|Number} dateRight - the second date to check
* @returns {Boolean} the dates are in the same day
*
* @example
* // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
* var result = isSameDay(
* new Date(2014, 8, 4, 6, 0),
* new Date(2014, 8, 4, 18, 0)
* )
* //=> true
*/
function isSameDay (dirtyDateLeft, dirtyDateRight) {
var dateLeftStartOfDay = startOfDay(dirtyDateLeft)
var dateRightStartOfDay = startOfDay(dirtyDateRight)
return dateLeftStartOfDay.getTime() === dateRightStartOfDay.getTime()
}
module.exports = isSameDay
/***/ }),
/* 250 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Saturday?
*
* @description
* Is the given date Saturday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Saturday
*
* @example
* // Is 27 September 2014 Saturday?
* var result = isSaturday(new Date(2014, 8, 27))
* //=> true
*/
function isSaturday (dirtyDate) {
return parse(dirtyDate).getDay() === 6
}
module.exports = isSaturday
/***/ }),
/* 251 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Sunday?
*
* @description
* Is the given date Sunday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Sunday
*
* @example
* // Is 21 September 2014 Sunday?
* var result = isSunday(new Date(2014, 8, 21))
* //=> true
*/
function isSunday (dirtyDate) {
return parse(dirtyDate).getDay() === 0
}
module.exports = isSunday
/***/ }),
/* 252 */
/***/ (function(module, exports, __webpack_require__) {
var isSameHour = __webpack_require__(146)
/**
* @category Hour Helpers
* @summary Is the given date in the same hour as the current date?
*
* @description
* Is the given date in the same hour as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this hour
*
* @example
* // If now is 25 September 2014 18:30:15.500,
* // is 25 September 2014 18:00:00 in this hour?
* var result = isThisHour(new Date(2014, 8, 25, 18))
* //=> true
*/
function isThisHour (dirtyDate) {
return isSameHour(new Date(), dirtyDate)
}
module.exports = isThisHour
/***/ }),
/* 253 */
/***/ (function(module, exports, __webpack_require__) {
var isSameISOWeek = __webpack_require__(148)
/**
* @category ISO Week Helpers
* @summary Is the given date in the same ISO week as the current date?
*
* @description
* Is the given date in the same ISO week as the current date?
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this ISO week
*
* @example
* // If today is 25 September 2014, is 22 September 2014 in this ISO week?
* var result = isThisISOWeek(new Date(2014, 8, 22))
* //=> true
*/
function isThisISOWeek (dirtyDate) {
return isSameISOWeek(new Date(), dirtyDate)
}
module.exports = isThisISOWeek
/***/ }),
/* 254 */
/***/ (function(module, exports, __webpack_require__) {
var isSameISOYear = __webpack_require__(149)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Is the given date in the same ISO week-numbering year as the current date?
*
* @description
* Is the given date in the same ISO week-numbering year as the current date?
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this ISO week-numbering year
*
* @example
* // If today is 25 September 2014,
* // is 30 December 2013 in this ISO week-numbering year?
* var result = isThisISOYear(new Date(2013, 11, 30))
* //=> true
*/
function isThisISOYear (dirtyDate) {
return isSameISOYear(new Date(), dirtyDate)
}
module.exports = isThisISOYear
/***/ }),
/* 255 */
/***/ (function(module, exports, __webpack_require__) {
var isSameMinute = __webpack_require__(150)
/**
* @category Minute Helpers
* @summary Is the given date in the same minute as the current date?
*
* @description
* Is the given date in the same minute as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this minute
*
* @example
* // If now is 25 September 2014 18:30:15.500,
* // is 25 September 2014 18:30:00 in this minute?
* var result = isThisMinute(new Date(2014, 8, 25, 18, 30))
* //=> true
*/
function isThisMinute (dirtyDate) {
return isSameMinute(new Date(), dirtyDate)
}
module.exports = isThisMinute
/***/ }),
/* 256 */
/***/ (function(module, exports, __webpack_require__) {
var isSameMonth = __webpack_require__(152)
/**
* @category Month Helpers
* @summary Is the given date in the same month as the current date?
*
* @description
* Is the given date in the same month as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this month
*
* @example
* // If today is 25 September 2014, is 15 September 2014 in this month?
* var result = isThisMonth(new Date(2014, 8, 15))
* //=> true
*/
function isThisMonth (dirtyDate) {
return isSameMonth(new Date(), dirtyDate)
}
module.exports = isThisMonth
/***/ }),
/* 257 */
/***/ (function(module, exports, __webpack_require__) {
var isSameQuarter = __webpack_require__(153)
/**
* @category Quarter Helpers
* @summary Is the given date in the same quarter as the current date?
*
* @description
* Is the given date in the same quarter as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this quarter
*
* @example
* // If today is 25 September 2014, is 2 July 2014 in this quarter?
* var result = isThisQuarter(new Date(2014, 6, 2))
* //=> true
*/
function isThisQuarter (dirtyDate) {
return isSameQuarter(new Date(), dirtyDate)
}
module.exports = isThisQuarter
/***/ }),
/* 258 */
/***/ (function(module, exports, __webpack_require__) {
var isSameSecond = __webpack_require__(155)
/**
* @category Second Helpers
* @summary Is the given date in the same second as the current date?
*
* @description
* Is the given date in the same second as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this second
*
* @example
* // If now is 25 September 2014 18:30:15.500,
* // is 25 September 2014 18:30:15.000 in this second?
* var result = isThisSecond(new Date(2014, 8, 25, 18, 30, 15))
* //=> true
*/
function isThisSecond (dirtyDate) {
return isSameSecond(new Date(), dirtyDate)
}
module.exports = isThisSecond
/***/ }),
/* 259 */
/***/ (function(module, exports, __webpack_require__) {
var isSameWeek = __webpack_require__(123)
/**
* @category Week Helpers
* @summary Is the given date in the same week as the current date?
*
* @description
* Is the given date in the same week as the current date?
*
* @param {Date|String|Number} date - the date to check
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Boolean} the date is in this week
*
* @example
* // If today is 25 September 2014, is 21 September 2014 in this week?
* var result = isThisWeek(new Date(2014, 8, 21))
* //=> true
*
* @example
* // If today is 25 September 2014 and week starts with Monday
* // is 21 September 2014 in this week?
* var result = isThisWeek(new Date(2014, 8, 21), {weekStartsOn: 1})
* //=> false
*/
function isThisWeek (dirtyDate, dirtyOptions) {
return isSameWeek(new Date(), dirtyDate, dirtyOptions)
}
module.exports = isThisWeek
/***/ }),
/* 260 */
/***/ (function(module, exports, __webpack_require__) {
var isSameYear = __webpack_require__(157)
/**
* @category Year Helpers
* @summary Is the given date in the same year as the current date?
*
* @description
* Is the given date in the same year as the current date?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is in this year
*
* @example
* // If today is 25 September 2014, is 2 July 2014 in this year?
* var result = isThisYear(new Date(2014, 6, 2))
* //=> true
*/
function isThisYear (dirtyDate) {
return isSameYear(new Date(), dirtyDate)
}
module.exports = isThisYear
/***/ }),
/* 261 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Thursday?
*
* @description
* Is the given date Thursday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Thursday
*
* @example
* // Is 25 September 2014 Thursday?
* var result = isThursday(new Date(2014, 8, 25))
* //=> true
*/
function isThursday (dirtyDate) {
return parse(dirtyDate).getDay() === 4
}
module.exports = isThursday
/***/ }),
/* 262 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
/**
* @category Day Helpers
* @summary Is the given date today?
*
* @description
* Is the given date today?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is today
*
* @example
* // If today is 6 October 2014, is 6 October 14:00:00 today?
* var result = isToday(new Date(2014, 9, 6, 14, 0))
* //=> true
*/
function isToday (dirtyDate) {
return startOfDay(dirtyDate).getTime() === startOfDay(new Date()).getTime()
}
module.exports = isToday
/***/ }),
/* 263 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
/**
* @category Day Helpers
* @summary Is the given date tomorrow?
*
* @description
* Is the given date tomorrow?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is tomorrow
*
* @example
* // If today is 6 October 2014, is 7 October 14:00:00 tomorrow?
* var result = isTomorrow(new Date(2014, 9, 7, 14, 0))
* //=> true
*/
function isTomorrow (dirtyDate) {
var tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 1)
return startOfDay(dirtyDate).getTime() === startOfDay(tomorrow).getTime()
}
module.exports = isTomorrow
/***/ }),
/* 264 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Tuesday?
*
* @description
* Is the given date Tuesday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Tuesday
*
* @example
* // Is 23 September 2014 Tuesday?
* var result = isTuesday(new Date(2014, 8, 23))
* //=> true
*/
function isTuesday (dirtyDate) {
return parse(dirtyDate).getDay() === 2
}
module.exports = isTuesday
/***/ }),
/* 265 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Is the given date Wednesday?
*
* @description
* Is the given date Wednesday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is Wednesday
*
* @example
* // Is 24 September 2014 Wednesday?
* var result = isWednesday(new Date(2014, 8, 24))
* //=> true
*/
function isWednesday (dirtyDate) {
return parse(dirtyDate).getDay() === 3
}
module.exports = isWednesday
/***/ }),
/* 266 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Weekday Helpers
* @summary Does the given date fall on a weekend?
*
* @description
* Does the given date fall on a weekend?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date falls on a weekend
*
* @example
* // Does 5 October 2014 fall on a weekend?
* var result = isWeekend(new Date(2014, 9, 5))
* //=> true
*/
function isWeekend (dirtyDate) {
var date = parse(dirtyDate)
var day = date.getDay()
return day === 0 || day === 6
}
module.exports = isWeekend
/***/ }),
/* 267 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Range Helpers
* @summary Is the given date within the range?
*
* @description
* Is the given date within the range?
*
* @param {Date|String|Number} date - the date to check
* @param {Date|String|Number} startDate - the start of range
* @param {Date|String|Number} endDate - the end of range
* @returns {Boolean} the date is within the range
* @throws {Error} startDate cannot be after endDate
*
* @example
* // For the date within the range:
* isWithinRange(
* new Date(2014, 0, 3), new Date(2014, 0, 1), new Date(2014, 0, 7)
* )
* //=> true
*
* @example
* // For the date outside of the range:
* isWithinRange(
* new Date(2014, 0, 10), new Date(2014, 0, 1), new Date(2014, 0, 7)
* )
* //=> false
*/
function isWithinRange (dirtyDate, dirtyStartDate, dirtyEndDate) {
var time = parse(dirtyDate).getTime()
var startTime = parse(dirtyStartDate).getTime()
var endTime = parse(dirtyEndDate).getTime()
if (startTime > endTime) {
throw new Error('The start of the range cannot be after the end of the range')
}
return time >= startTime && time <= endTime
}
module.exports = isWithinRange
/***/ }),
/* 268 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
/**
* @category Day Helpers
* @summary Is the given date yesterday?
*
* @description
* Is the given date yesterday?
*
* @param {Date|String|Number} date - the date to check
* @returns {Boolean} the date is yesterday
*
* @example
* // If today is 6 October 2014, is 5 October 14:00:00 yesterday?
* var result = isYesterday(new Date(2014, 9, 5, 14, 0))
* //=> true
*/
function isYesterday (dirtyDate) {
var yesterday = new Date()
yesterday.setDate(yesterday.getDate() - 1)
return startOfDay(dirtyDate).getTime() === startOfDay(yesterday).getTime()
}
module.exports = isYesterday
/***/ }),
/* 269 */
/***/ (function(module, exports, __webpack_require__) {
var lastDayOfWeek = __webpack_require__(158)
/**
* @category ISO Week Helpers
* @summary Return the last day of an ISO week for the given date.
*
* @description
* Return the last day of an ISO week for the given date.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the last day of an ISO week
*
* @example
* // The last day of an ISO week for 2 September 2014 11:55:00:
* var result = lastDayOfISOWeek(new Date(2014, 8, 2, 11, 55, 0))
* //=> Sun Sep 07 2014 00:00:00
*/
function lastDayOfISOWeek (dirtyDate) {
return lastDayOfWeek(dirtyDate, {weekStartsOn: 1})
}
module.exports = lastDayOfISOWeek
/***/ }),
/* 270 */
/***/ (function(module, exports, __webpack_require__) {
var getISOYear = __webpack_require__(2)
var startOfISOWeek = __webpack_require__(3)
/**
* @category ISO Week-Numbering Year Helpers
* @summary Return the last day of an ISO week-numbering year for the given date.
*
* @description
* Return the last day of an ISO week-numbering year,
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the end of an ISO week-numbering year
*
* @example
* // The last day of an ISO week-numbering year for 2 July 2005:
* var result = lastDayOfISOYear(new Date(2005, 6, 2))
* //=> Sun Jan 01 2006 00:00:00
*/
function lastDayOfISOYear (dirtyDate) {
var year = getISOYear(dirtyDate)
var fourthOfJanuary = new Date(0)
fourthOfJanuary.setFullYear(year + 1, 0, 4)
fourthOfJanuary.setHours(0, 0, 0, 0)
var date = startOfISOWeek(fourthOfJanuary)
date.setDate(date.getDate() - 1)
return date
}
module.exports = lastDayOfISOYear
/***/ }),
/* 271 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Return the last day of a month for the given date.
*
* @description
* Return the last day of a month for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the last day of a month
*
* @example
* // The last day of a month for 2 September 2014 11:55:00:
* var result = lastDayOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 00:00:00
*/
function lastDayOfMonth (dirtyDate) {
var date = parse(dirtyDate)
var month = date.getMonth()
date.setFullYear(date.getFullYear(), month + 1, 0)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = lastDayOfMonth
/***/ }),
/* 272 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Quarter Helpers
* @summary Return the last day of a year quarter for the given date.
*
* @description
* Return the last day of a year quarter for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the last day of a quarter
*
* @example
* // The last day of a quarter for 2 September 2014 11:55:00:
* var result = lastDayOfQuarter(new Date(2014, 8, 2, 11, 55, 0))
* //=> Tue Sep 30 2014 00:00:00
*/
function lastDayOfQuarter (dirtyDate) {
var date = parse(dirtyDate)
var currentMonth = date.getMonth()
var month = currentMonth - currentMonth % 3 + 3
date.setMonth(month, 0)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = lastDayOfQuarter
/***/ }),
/* 273 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Return the last day of a year for the given date.
*
* @description
* Return the last day of a year for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the last day of a year
*
* @example
* // The last day of a year for 2 September 2014 11:55:00:
* var result = lastDayOfYear(new Date(2014, 8, 2, 11, 55, 00))
* //=> Wed Dec 31 2014 00:00:00
*/
function lastDayOfYear (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
date.setFullYear(year + 1, 0, 0)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = lastDayOfYear
/***/ }),
/* 274 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Return the latest of the given dates.
*
* @description
* Return the latest of the given dates.
*
* @param {...(Date|String|Number)} dates - the dates to compare
* @returns {Date} the latest of the dates
*
* @example
* // Which of these dates is the latest?
* var result = max(
* new Date(1989, 6, 10),
* new Date(1987, 1, 11),
* new Date(1995, 6, 2),
* new Date(1990, 0, 1)
* )
* //=> Sun Jul 02 1995 00:00:00
*/
function max () {
var dirtyDates = Array.prototype.slice.call(arguments)
var dates = dirtyDates.map(function (dirtyDate) {
return parse(dirtyDate)
})
var latestTimestamp = Math.max.apply(null, dates)
return new Date(latestTimestamp)
}
module.exports = max
/***/ }),
/* 275 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Common Helpers
* @summary Return the earliest of the given dates.
*
* @description
* Return the earliest of the given dates.
*
* @param {...(Date|String|Number)} dates - the dates to compare
* @returns {Date} the earliest of the dates
*
* @example
* // Which of these dates is the earliest?
* var result = min(
* new Date(1989, 6, 10),
* new Date(1987, 1, 11),
* new Date(1995, 6, 2),
* new Date(1990, 0, 1)
* )
* //=> Wed Feb 11 1987 00:00:00
*/
function min () {
var dirtyDates = Array.prototype.slice.call(arguments)
var dates = dirtyDates.map(function (dirtyDate) {
return parse(dirtyDate)
})
var earliestTimestamp = Math.min.apply(null, dates)
return new Date(earliestTimestamp)
}
module.exports = min
/***/ }),
/* 276 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Set the day of the month to the given date.
*
* @description
* Set the day of the month to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} dayOfMonth - the day of the month of the new date
* @returns {Date} the new date with the day of the month setted
*
* @example
* // Set the 30th day of the month to 1 September 2014:
* var result = setDate(new Date(2014, 8, 1), 30)
* //=> Tue Sep 30 2014 00:00:00
*/
function setDate (dirtyDate, dirtyDayOfMonth) {
var date = parse(dirtyDate)
var dayOfMonth = Number(dirtyDayOfMonth)
date.setDate(dayOfMonth)
return date
}
module.exports = setDate
/***/ }),
/* 277 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var addDays = __webpack_require__(6)
/**
* @category Weekday Helpers
* @summary Set the day of the week to the given date.
*
* @description
* Set the day of the week to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} day - the day of the week of the new date
* @param {Object} [options] - the object with options
* @param {Number} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
* @returns {Date} the new date with the day of the week setted
*
* @example
* // Set Sunday to 1 September 2014:
* var result = setDay(new Date(2014, 8, 1), 0)
* //=> Sun Aug 31 2014 00:00:00
*
* @example
* // If week starts with Monday, set Sunday to 1 September 2014:
* var result = setDay(new Date(2014, 8, 1), 0, {weekStartsOn: 1})
* //=> Sun Sep 07 2014 00:00:00
*/
function setDay (dirtyDate, dirtyDay, dirtyOptions) {
var weekStartsOn = dirtyOptions ? (Number(dirtyOptions.weekStartsOn) || 0) : 0
var date = parse(dirtyDate)
var day = Number(dirtyDay)
var currentDay = date.getDay()
var remainder = day % 7
var dayIndex = (remainder + 7) % 7
var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay
return addDays(date, diff)
}
module.exports = setDay
/***/ }),
/* 278 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Day Helpers
* @summary Set the day of the year to the given date.
*
* @description
* Set the day of the year to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} dayOfYear - the day of the year of the new date
* @returns {Date} the new date with the day of the year setted
*
* @example
* // Set the 2nd day of the year to 2 July 2014:
* var result = setDayOfYear(new Date(2014, 6, 2), 2)
* //=> Thu Jan 02 2014 00:00:00
*/
function setDayOfYear (dirtyDate, dirtyDayOfYear) {
var date = parse(dirtyDate)
var dayOfYear = Number(dirtyDayOfYear)
date.setMonth(0)
date.setDate(dayOfYear)
return date
}
module.exports = setDayOfYear
/***/ }),
/* 279 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Hour Helpers
* @summary Set the hours to the given date.
*
* @description
* Set the hours to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} hours - the hours of the new date
* @returns {Date} the new date with the hours setted
*
* @example
* // Set 4 hours to 1 September 2014 11:30:00:
* var result = setHours(new Date(2014, 8, 1, 11, 30), 4)
* //=> Mon Sep 01 2014 04:30:00
*/
function setHours (dirtyDate, dirtyHours) {
var date = parse(dirtyDate)
var hours = Number(dirtyHours)
date.setHours(hours)
return date
}
module.exports = setHours
/***/ }),
/* 280 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var addDays = __webpack_require__(6)
var getISODay = __webpack_require__(145)
/**
* @category Weekday Helpers
* @summary Set the day of the ISO week to the given date.
*
* @description
* Set the day of the ISO week to the given date.
* ISO week starts with Monday.
* 7 is the index of Sunday, 1 is the index of Monday etc.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} day - the day of the ISO week of the new date
* @returns {Date} the new date with the day of the ISO week setted
*
* @example
* // Set Sunday to 1 September 2014:
* var result = setISODay(new Date(2014, 8, 1), 7)
* //=> Sun Sep 07 2014 00:00:00
*/
function setISODay (dirtyDate, dirtyDay) {
var date = parse(dirtyDate)
var day = Number(dirtyDay)
var currentDay = getISODay(date)
var diff = day - currentDay
return addDays(date, diff)
}
module.exports = setISODay
/***/ }),
/* 281 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var getISOWeek = __webpack_require__(122)
/**
* @category ISO Week Helpers
* @summary Set the ISO week to the given date.
*
* @description
* Set the ISO week to the given date, saving the weekday number.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} isoWeek - the ISO week of the new date
* @returns {Date} the new date with the ISO week setted
*
* @example
* // Set the 53rd ISO week to 7 August 2004:
* var result = setISOWeek(new Date(2004, 7, 7), 53)
* //=> Sat Jan 01 2005 00:00:00
*/
function setISOWeek (dirtyDate, dirtyISOWeek) {
var date = parse(dirtyDate)
var isoWeek = Number(dirtyISOWeek)
var diff = getISOWeek(date) - isoWeek
date.setDate(date.getDate() - diff * 7)
return date
}
module.exports = setISOWeek
/***/ }),
/* 282 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Millisecond Helpers
* @summary Set the milliseconds to the given date.
*
* @description
* Set the milliseconds to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} milliseconds - the milliseconds of the new date
* @returns {Date} the new date with the milliseconds setted
*
* @example
* // Set 300 milliseconds to 1 September 2014 11:30:40.500:
* var result = setMilliseconds(new Date(2014, 8, 1, 11, 30, 40, 500), 300)
* //=> Mon Sep 01 2014 11:30:40.300
*/
function setMilliseconds (dirtyDate, dirtyMilliseconds) {
var date = parse(dirtyDate)
var milliseconds = Number(dirtyMilliseconds)
date.setMilliseconds(milliseconds)
return date
}
module.exports = setMilliseconds
/***/ }),
/* 283 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Minute Helpers
* @summary Set the minutes to the given date.
*
* @description
* Set the minutes to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} minutes - the minutes of the new date
* @returns {Date} the new date with the minutes setted
*
* @example
* // Set 45 minutes to 1 September 2014 11:30:40:
* var result = setMinutes(new Date(2014, 8, 1, 11, 30, 40), 45)
* //=> Mon Sep 01 2014 11:45:40
*/
function setMinutes (dirtyDate, dirtyMinutes) {
var date = parse(dirtyDate)
var minutes = Number(dirtyMinutes)
date.setMinutes(minutes)
return date
}
module.exports = setMinutes
/***/ }),
/* 284 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
var setMonth = __webpack_require__(159)
/**
* @category Quarter Helpers
* @summary Set the year quarter to the given date.
*
* @description
* Set the year quarter to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} quarter - the quarter of the new date
* @returns {Date} the new date with the quarter setted
*
* @example
* // Set the 2nd quarter to 2 July 2014:
* var result = setQuarter(new Date(2014, 6, 2), 2)
* //=> Wed Apr 02 2014 00:00:00
*/
function setQuarter (dirtyDate, dirtyQuarter) {
var date = parse(dirtyDate)
var quarter = Number(dirtyQuarter)
var oldQuarter = Math.floor(date.getMonth() / 3) + 1
var diff = quarter - oldQuarter
return setMonth(date, date.getMonth() + diff * 3)
}
module.exports = setQuarter
/***/ }),
/* 285 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Second Helpers
* @summary Set the seconds to the given date.
*
* @description
* Set the seconds to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} seconds - the seconds of the new date
* @returns {Date} the new date with the seconds setted
*
* @example
* // Set 45 seconds to 1 September 2014 11:30:40:
* var result = setSeconds(new Date(2014, 8, 1, 11, 30, 40), 45)
* //=> Mon Sep 01 2014 11:30:45
*/
function setSeconds (dirtyDate, dirtySeconds) {
var date = parse(dirtyDate)
var seconds = Number(dirtySeconds)
date.setSeconds(seconds)
return date
}
module.exports = setSeconds
/***/ }),
/* 286 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Year Helpers
* @summary Set the year to the given date.
*
* @description
* Set the year to the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} year - the year of the new date
* @returns {Date} the new date with the year setted
*
* @example
* // Set year 2013 to 1 September 2014:
* var result = setYear(new Date(2014, 8, 1), 2013)
* //=> Sun Sep 01 2013 00:00:00
*/
function setYear (dirtyDate, dirtyYear) {
var date = parse(dirtyDate)
var year = Number(dirtyYear)
date.setFullYear(year)
return date
}
module.exports = setYear
/***/ }),
/* 287 */
/***/ (function(module, exports, __webpack_require__) {
var parse = __webpack_require__(0)
/**
* @category Month Helpers
* @summary Return the start of a month for the given date.
*
* @description
* Return the start of a month for the given date.
* The result will be in the local timezone.
*
* @param {Date|String|Number} date - the original date
* @returns {Date} the start of a month
*
* @example
* // The start of a month for 2 September 2014 11:55:00:
* var result = startOfMonth(new Date(2014, 8, 2, 11, 55, 0))
* //=> Mon Sep 01 2014 00:00:00
*/
function startOfMonth (dirtyDate) {
var date = parse(dirtyDate)
date.setDate(1)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfMonth
/***/ }),
/* 288 */
/***/ (function(module, exports, __webpack_require__) {
var startOfDay = __webpack_require__(4)
/**
* @category Day Helpers
* @summary Return the start of today.
*
* @description
* Return the start of today.
*
* @returns {Date} the start of today
*
* @example
* // If today is 6 October 2014:
* var result = startOfToday()
* //=> Mon Oct 6 2014 00:00:00
*/
function startOfToday () {
return startOfDay(new Date())
}
module.exports = startOfToday
/***/ }),
/* 289 */
/***/ (function(module, exports) {
/**
* @category Day Helpers
* @summary Return the start of tomorrow.
*
* @description
* Return the start of tomorrow.
*
* @returns {Date} the start of tomorrow
*
* @example
* // If today is 6 October 2014:
* var result = startOfTomorrow()
* //=> Tue Oct 7 2014 00:00:00
*/
function startOfTomorrow () {
var now = new Date()
var year = now.getFullYear()
var month = now.getMonth()
var day = now.getDate()
var date = new Date(0)
date.setFullYear(year, month, day + 1)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfTomorrow
/***/ }),
/* 290 */
/***/ (function(module, exports) {
/**
* @category Day Helpers
* @summary Return the start of yesterday.
*
* @description
* Return the start of yesterday.
*
* @returns {Date} the start of yesterday
*
* @example
* // If today is 6 October 2014:
* var result = startOfYesterday()
* //=> Sun Oct 5 2014 00:00:00
*/
function startOfYesterday () {
var now = new Date()
var year = now.getFullYear()
var month = now.getMonth()
var day = now.getDate()
var date = new Date(0)
date.setFullYear(year, month, day - 1)
date.setHours(0, 0, 0, 0)
return date
}
module.exports = startOfYesterday
/***/ }),
/* 291 */
/***/ (function(module, exports, __webpack_require__) {
var addDays = __webpack_require__(6)
/**
* @category Day Helpers
* @summary Subtract the specified number of days from the given date.
*
* @description
* Subtract the specified number of days from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of days to be subtracted
* @returns {Date} the new date with the days subtracted
*
* @example
* // Subtract 10 days from 1 September 2014:
* var result = subDays(new Date(2014, 8, 1), 10)
* //=> Fri Aug 22 2014 00:00:00
*/
function subDays (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addDays(dirtyDate, -amount)
}
module.exports = subDays
/***/ }),
/* 292 */
/***/ (function(module, exports, __webpack_require__) {
var addHours = __webpack_require__(125)
/**
* @category Hour Helpers
* @summary Subtract the specified number of hours from the given date.
*
* @description
* Subtract the specified number of hours from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of hours to be subtracted
* @returns {Date} the new date with the hours subtracted
*
* @example
* // Subtract 2 hours from 11 July 2014 01:00:00:
* var result = subHours(new Date(2014, 6, 11, 1, 0), 2)
* //=> Thu Jul 10 2014 23:00:00
*/
function subHours (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addHours(dirtyDate, -amount)
}
module.exports = subHours
/***/ }),
/* 293 */
/***/ (function(module, exports, __webpack_require__) {
var addMilliseconds = __webpack_require__(7)
/**
* @category Millisecond Helpers
* @summary Subtract the specified number of milliseconds from the given date.
*
* @description
* Subtract the specified number of milliseconds from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of milliseconds to be subtracted
* @returns {Date} the new date with the milliseconds subtracted
*
* @example
* // Subtract 750 milliseconds from 10 July 2014 12:45:30.000:
* var result = subMilliseconds(new Date(2014, 6, 10, 12, 45, 30, 0), 750)
* //=> Thu Jul 10 2014 12:45:29.250
*/
function subMilliseconds (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMilliseconds(dirtyDate, -amount)
}
module.exports = subMilliseconds
/***/ }),
/* 294 */
/***/ (function(module, exports, __webpack_require__) {
var addMinutes = __webpack_require__(128)
/**
* @category Minute Helpers
* @summary Subtract the specified number of minutes from the given date.
*
* @description
* Subtract the specified number of minutes from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of minutes to be subtracted
* @returns {Date} the new date with the mintues subtracted
*
* @example
* // Subtract 30 minutes from 10 July 2014 12:00:00:
* var result = subMinutes(new Date(2014, 6, 10, 12, 0), 30)
* //=> Thu Jul 10 2014 11:30:00
*/
function subMinutes (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMinutes(dirtyDate, -amount)
}
module.exports = subMinutes
/***/ }),
/* 295 */
/***/ (function(module, exports, __webpack_require__) {
var addMonths = __webpack_require__(80)
/**
* @category Month Helpers
* @summary Subtract the specified number of months from the given date.
*
* @description
* Subtract the specified number of months from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of months to be subtracted
* @returns {Date} the new date with the months subtracted
*
* @example
* // Subtract 5 months from 1 February 2015:
* var result = subMonths(new Date(2015, 1, 1), 5)
* //=> Mon Sep 01 2014 00:00:00
*/
function subMonths (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addMonths(dirtyDate, -amount)
}
module.exports = subMonths
/***/ }),
/* 296 */
/***/ (function(module, exports, __webpack_require__) {
var addQuarters = __webpack_require__(129)
/**
* @category Quarter Helpers
* @summary Subtract the specified number of year quarters from the given date.
*
* @description
* Subtract the specified number of year quarters from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of quarters to be subtracted
* @returns {Date} the new date with the quarters subtracted
*
* @example
* // Subtract 3 quarters from 1 September 2014:
* var result = subQuarters(new Date(2014, 8, 1), 3)
* //=> Sun Dec 01 2013 00:00:00
*/
function subQuarters (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addQuarters(dirtyDate, -amount)
}
module.exports = subQuarters
/***/ }),
/* 297 */
/***/ (function(module, exports, __webpack_require__) {
var addSeconds = __webpack_require__(130)
/**
* @category Second Helpers
* @summary Subtract the specified number of seconds from the given date.
*
* @description
* Subtract the specified number of seconds from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of seconds to be subtracted
* @returns {Date} the new date with the seconds subtracted
*
* @example
* // Subtract 30 seconds from 10 July 2014 12:45:00:
* var result = subSeconds(new Date(2014, 6, 10, 12, 45, 0), 30)
* //=> Thu Jul 10 2014 12:44:30
*/
function subSeconds (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addSeconds(dirtyDate, -amount)
}
module.exports = subSeconds
/***/ }),
/* 298 */
/***/ (function(module, exports, __webpack_require__) {
var addWeeks = __webpack_require__(117)
/**
* @category Week Helpers
* @summary Subtract the specified number of weeks from the given date.
*
* @description
* Subtract the specified number of weeks from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of weeks to be subtracted
* @returns {Date} the new date with the weeks subtracted
*
* @example
* // Subtract 4 weeks from 1 September 2014:
* var result = subWeeks(new Date(2014, 8, 1), 4)
* //=> Mon Aug 04 2014 00:00:00
*/
function subWeeks (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addWeeks(dirtyDate, -amount)
}
module.exports = subWeeks
/***/ }),
/* 299 */
/***/ (function(module, exports, __webpack_require__) {
var addYears = __webpack_require__(131)
/**
* @category Year Helpers
* @summary Subtract the specified number of years from the given date.
*
* @description
* Subtract the specified number of years from the given date.
*
* @param {Date|String|Number} date - the date to be changed
* @param {Number} amount - the amount of years to be subtracted
* @returns {Date} the new date with the years subtracted
*
* @example
* // Subtract 5 years from 1 September 2014:
* var result = subYears(new Date(2014, 8, 1), 5)
* //=> Tue Sep 01 2009 00:00:00
*/
function subYears (dirtyDate, dirtyAmount) {
var amount = Number(dirtyAmount)
return addYears(dirtyDate, -amount)
}
module.exports = subYears
/***/ }),
/* 300 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 301 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {
startDate: undefined,
endDate: undefined,
minDate: null,
maxDate: null,
isRange: false,
disabledDates: [],
disabledWeekDays: undefined,
lang: 'en', // internationalization
dateFormat: 'MM/DD/YYYY',
displayMode: 'default',
showHeader: true,
showFooter: true,
todayButton: true,
clearButton: true,
labelFrom: '',
labelTo: '',
weekStart: 0,
closeOnOverlayClick: true,
closeOnSelect: true,
toggleOnInputClick: true,
icons: {
previous: '<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="45.63,75.8 0.375,38.087 45.63,0.375 "/>\n </svg>',
next: '<svg viewBox="0 0 50 80" xml:space="preserve">\n <polyline fill="none" stroke-width=".5em" stroke-linecap="round" stroke-linejoin="round" points="0.375,0.375 45.63,38.087 0.375,75.8 "/>\n </svg>'
}
};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 302 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_date_fns__ = __webpack_require__(124);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_date_fns___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_date_fns__);
/* harmony default export */ __webpack_exports__["a"] = (function (data) {
return '<div id=\'' + data.id + '\' class="datepicker ' + (data.displayMode === 'dialog' ? 'modal' : '') + '">\n ' + (data.displayMode === 'dialog' ? '<div class="modal-background"></div>' : '') + '\n <div class="calendar">\n <div class="calendar-header">\n <div class="calendar-selection-start">\n <div class="calendar-selection-from' + (data.labels.from === '' ? ' is-hidden' : '') + '">' + data.labels.from + '</div>\n <div class="calendar-selection-date">\n <div class="calendar-selection-day"></div>\n <div class="calendar-selection-details">\n <div class="calendar-selection-month"></div>\n <div class="calendar-selection-weekday"></div>\n </div>\n </div>\n </div>\n ' + (data.isRange ? '<div class="calendar-selection-end">\n <div class="calendar-selection-to' + (data.labels.to === '' ? ' is-hidden' : '') + '">' + data.labels.to + '</div>\n <div class="calendar-selection-date">\n <div class="calendar-selection-day"></div>\n <div class="calendar-selection-details">\n <div class="calendar-selection-month"></div>\n <div class="calendar-selection-weekday"></div>\n </div>\n </div>\n </div>' : '') + '\n </div>\n <div class="calendar-nav">\n <button class="calendar-nav-previous button is-small is-text">' + data.icons.previous + '</button>\n <div class="calendar-nav-month-year">\n <div class="calendar-nav-month">' + Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["format"])(data.visibleDate, 'MMMM', { locale: data.locale }) + '</div>\n \n <div class="calendar-nav-year">' + Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["format"])(data.visibleDate, 'YYYY', { locale: data.locale }) + '</div>\n </div>\n <button class="calendar-nav-next button is-small is-text">' + data.icons.next + '</button>\n </div>\n <div class="calendar-body">\n <div class="calendar-dates is-active">\n <div class="calendar-weekdays">\n ' + data.labels.weekdays.map(function (day) {
return '<div class="calendar-date">' + day + '</div>';
}).join('') + '\n </div>\n <div class="calendar-days"></div>\n </div>\n <div class="calendar-months">\n ' + new Array(12).fill(new Date('01/01/1970')).map(function (d, i) {
return '<div class="calendar-month" data-month="' + Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["format"])(Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["addMonths"])(d, i), 'MM', {
locale: data.locale
}) + '">' + Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["format"])(Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["addMonths"])(d, i), 'MMM', {
locale: data.locale
}) + '</div>';
}).join('') + '\n </div>\n <div class="calendar-years">\n ' + data.years.map(function (year) {
return '<div class="calendar-year' + (year === Object(__WEBPACK_IMPORTED_MODULE_0_date_fns__["getMonth"])(data.visibleDate) ? ' is-active' : '') + '" data-year="' + year + '"><span class="item">' + year + '</span></div>';
}).join('') + '\n </div>\n </div>\n <div class="calendar-footer">\n <button class="calendar-footer-validate has-text-success button is-small is-text">' + (data.icons.validate ? data.icons.validate : '') + ' Validate</button>\n <button class="calendar-footer-today has-text-warning button is-small is-text">' + (data.icons.today ? data.icons.today : '') + ' Today</button>\n <button class="calendar-footer-clear has-text-danger button is-small is-text">' + (data.icons.clear ? data.icons.clear : '') + ' Clear</button>\n <button class="calendar-footer-cancel button is-small is-text">' + (data.icons.cancel ? data.icons.cancel : '') + ' Cancel</button>\n </div>\n </div>\n </div>';
});
/***/ }),
/* 303 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony default export */ __webpack_exports__["a"] = (function (days) {
return '' + days.map(function (theDate) {
return '<div data-date="' + theDate.date.toString() + '" class="calendar-date' + (theDate.isThisMonth ? ' is-current-month' : '') + (theDate.isDisabled ? ' is-disabled' : '') + (theDate.isRange && theDate.isInRange ? ' calendar-range' : '') + (theDate.isStartDate ? ' calendar-range-start' : '') + (theDate.isEndDate ? ' calendar-range-end' : '') + '">\n <button class="date-item' + (theDate.isToday ? ' is-today' : '') + (theDate.isStartDate ? ' is-active' : '') + '">' + theDate.date.getDate() + '</button>\n </div>';
}).join('');
});
/***/ }),
/* 304 */
/***/ (function(module, exports, __webpack_require__) {
var map = {
"./_lib/build_formatting_tokens_reg_exp": 1,
"./_lib/build_formatting_tokens_reg_exp/": 1,
"./_lib/build_formatting_tokens_reg_exp/index": 1,
"./_lib/build_formatting_tokens_reg_exp/index.js": 1,
"./_lib/package": 160,
"./_lib/package.json": 160,
"./ar": 82,
"./ar/": 82,
"./ar/build_distance_in_words_locale": 12,
"./ar/build_distance_in_words_locale/": 12,
"./ar/build_distance_in_words_locale/index": 12,
"./ar/build_distance_in_words_locale/index.js": 12,
"./ar/build_format_locale": 13,
"./ar/build_format_locale/": 13,
"./ar/build_format_locale/index": 13,
"./ar/build_format_locale/index.js": 13,
"./ar/index": 82,
"./ar/index.js": 82,
"./ar/package": 161,
"./ar/package.json": 161,
"./bg": 83,
"./bg/": 83,
"./bg/build_distance_in_words_locale": 14,
"./bg/build_distance_in_words_locale/": 14,
"./bg/build_distance_in_words_locale/index": 14,
"./bg/build_distance_in_words_locale/index.js": 14,
"./bg/build_format_locale": 15,
"./bg/build_format_locale/": 15,
"./bg/build_format_locale/index": 15,
"./bg/build_format_locale/index.js": 15,
"./bg/index": 83,
"./bg/index.js": 83,
"./bg/package": 162,
"./bg/package.json": 162,
"./ca": 84,
"./ca/": 84,
"./ca/build_distance_in_words_locale": 16,
"./ca/build_distance_in_words_locale/": 16,
"./ca/build_distance_in_words_locale/index": 16,
"./ca/build_distance_in_words_locale/index.js": 16,
"./ca/build_format_locale": 17,
"./ca/build_format_locale/": 17,
"./ca/build_format_locale/index": 17,
"./ca/build_format_locale/index.js": 17,
"./ca/index": 84,
"./ca/index.js": 84,
"./ca/package": 163,
"./ca/package.json": 163,
"./cs": 85,
"./cs/": 85,
"./cs/build_distance_in_words_locale": 18,
"./cs/build_distance_in_words_locale/": 18,
"./cs/build_distance_in_words_locale/index": 18,
"./cs/build_distance_in_words_locale/index.js": 18,
"./cs/build_format_locale": 19,
"./cs/build_format_locale/": 19,
"./cs/build_format_locale/index": 19,
"./cs/build_format_locale/index.js": 19,
"./cs/index": 85,
"./cs/index.js": 85,
"./cs/package": 164,
"./cs/package.json": 164,
"./da": 86,
"./da/": 86,
"./da/build_distance_in_words_locale": 20,
"./da/build_distance_in_words_locale/": 20,
"./da/build_distance_in_words_locale/index": 20,
"./da/build_distance_in_words_locale/index.js": 20,
"./da/build_format_locale": 21,
"./da/build_format_locale/": 21,
"./da/build_format_locale/index": 21,
"./da/build_format_locale/index.js": 21,
"./da/index": 86,
"./da/index.js": 86,
"./da/package": 165,
"./da/package.json": 165,
"./de": 87,
"./de/": 87,
"./de/build_distance_in_words_locale": 22,
"./de/build_distance_in_words_locale/": 22,
"./de/build_distance_in_words_locale/index": 22,
"./de/build_distance_in_words_locale/index.js": 22,
"./de/build_format_locale": 23,
"./de/build_format_locale/": 23,
"./de/build_format_locale/index": 23,
"./de/build_format_locale/index.js": 23,
"./de/index": 87,
"./de/index.js": 87,
"./de/package": 166,
"./de/package.json": 166,
"./el": 88,
"./el/": 88,
"./el/build_distance_in_words_locale": 24,
"./el/build_distance_in_words_locale/": 24,
"./el/build_distance_in_words_locale/index": 24,
"./el/build_distance_in_words_locale/index.js": 24,
"./el/build_format_locale": 25,
"./el/build_format_locale/": 25,
"./el/build_format_locale/index": 25,
"./el/build_format_locale/index.js": 25,
"./el/index": 88,
"./el/index.js": 88,
"./el/package": 167,
"./el/package.json": 167,
"./en": 5,
"./en/": 5,
"./en/build_distance_in_words_locale": 10,
"./en/build_distance_in_words_locale/": 10,
"./en/build_distance_in_words_locale/index": 10,
"./en/build_distance_in_words_locale/index.js": 10,
"./en/build_format_locale": 11,
"./en/build_format_locale/": 11,
"./en/build_format_locale/index": 11,
"./en/build_format_locale/index.js": 11,
"./en/index": 5,
"./en/index.js": 5,
"./en/package": 168,
"./en/package.json": 168,
"./eo": 89,
"./eo/": 89,
"./eo/build_distance_in_words_locale": 26,
"./eo/build_distance_in_words_locale/": 26,
"./eo/build_distance_in_words_locale/index": 26,
"./eo/build_distance_in_words_locale/index.js": 26,
"./eo/build_format_locale": 27,
"./eo/build_format_locale/": 27,
"./eo/build_format_locale/index": 27,
"./eo/build_format_locale/index.js": 27,
"./eo/index": 89,
"./eo/index.js": 89,
"./eo/package": 169,
"./eo/package.json": 169,
"./es": 90,
"./es/": 90,
"./es/build_distance_in_words_locale": 28,
"./es/build_distance_in_words_locale/": 28,
"./es/build_distance_in_words_locale/index": 28,
"./es/build_distance_in_words_locale/index.js": 28,
"./es/build_format_locale": 29,
"./es/build_format_locale/": 29,
"./es/build_format_locale/index": 29,
"./es/build_format_locale/index.js": 29,
"./es/index": 90,
"./es/index.js": 90,
"./es/package": 170,
"./es/package.json": 170,
"./fi": 91,
"./fi/": 91,
"./fi/build_distance_in_words_locale": 30,
"./fi/build_distance_in_words_locale/": 30,
"./fi/build_distance_in_words_locale/index": 30,
"./fi/build_distance_in_words_locale/index.js": 30,
"./fi/build_format_locale": 31,
"./fi/build_format_locale/": 31,
"./fi/build_format_locale/index": 31,
"./fi/build_format_locale/index.js": 31,
"./fi/index": 91,
"./fi/index.js": 91,
"./fi/package": 171,
"./fi/package.json": 171,
"./fil": 92,
"./fil/": 92,
"./fil/build_distance_in_words_locale": 32,
"./fil/build_distance_in_words_locale/": 32,
"./fil/build_distance_in_words_locale/index": 32,
"./fil/build_distance_in_words_locale/index.js": 32,
"./fil/build_format_locale": 33,
"./fil/build_format_locale/": 33,
"./fil/build_format_locale/index": 33,
"./fil/build_format_locale/index.js": 33,
"./fil/index": 92,
"./fil/index.js": 92,
"./fil/package": 172,
"./fil/package.json": 172,
"./fr": 93,
"./fr/": 93,
"./fr/build_distance_in_words_locale": 34,
"./fr/build_distance_in_words_locale/": 34,
"./fr/build_distance_in_words_locale/index": 34,
"./fr/build_distance_in_words_locale/index.js": 34,
"./fr/build_format_locale": 35,
"./fr/build_format_locale/": 35,
"./fr/build_format_locale/index": 35,
"./fr/build_format_locale/index.js": 35,
"./fr/index": 93,
"./fr/index.js": 93,
"./fr/package": 173,
"./fr/package.json": 173,
"./hr": 94,
"./hr/": 94,
"./hr/build_distance_in_words_locale": 36,
"./hr/build_distance_in_words_locale/": 36,
"./hr/build_distance_in_words_locale/index": 36,
"./hr/build_distance_in_words_locale/index.js": 36,
"./hr/build_format_locale": 37,
"./hr/build_format_locale/": 37,
"./hr/build_format_locale/index": 37,
"./hr/build_format_locale/index.js": 37,
"./hr/index": 94,
"./hr/index.js": 94,
"./hr/package": 174,
"./hr/package.json": 174,
"./hu": 95,
"./hu/": 95,
"./hu/build_distance_in_words_locale": 38,
"./hu/build_distance_in_words_locale/": 38,
"./hu/build_distance_in_words_locale/index": 38,
"./hu/build_distance_in_words_locale/index.js": 38,
"./hu/build_format_locale": 39,
"./hu/build_format_locale/": 39,
"./hu/build_format_locale/index": 39,
"./hu/build_format_locale/index.js": 39,
"./hu/index": 95,
"./hu/index.js": 95,
"./hu/package": 175,
"./hu/package.json": 175,
"./id": 96,
"./id/": 96,
"./id/build_distance_in_words_locale": 40,
"./id/build_distance_in_words_locale/": 40,
"./id/build_distance_in_words_locale/index": 40,
"./id/build_distance_in_words_locale/index.js": 40,
"./id/build_format_locale": 41,
"./id/build_format_locale/": 41,
"./id/build_format_locale/index": 41,
"./id/build_format_locale/index.js": 41,
"./id/index": 96,
"./id/index.js": 96,
"./id/package": 176,
"./id/package.json": 176,
"./is": 97,
"./is/": 97,
"./is/build_distance_in_words_locale": 42,
"./is/build_distance_in_words_locale/": 42,
"./is/build_distance_in_words_locale/index": 42,
"./is/build_distance_in_words_locale/index.js": 42,
"./is/build_format_locale": 43,
"./is/build_format_locale/": 43,
"./is/build_format_locale/index": 43,
"./is/build_format_locale/index.js": 43,
"./is/index": 97,
"./is/index.js": 97,
"./is/package": 177,
"./is/package.json": 177,
"./it": 98,
"./it/": 98,
"./it/build_distance_in_words_locale": 44,
"./it/build_distance_in_words_locale/": 44,
"./it/build_distance_in_words_locale/index": 44,
"./it/build_distance_in_words_locale/index.js": 44,
"./it/build_format_locale": 45,
"./it/build_format_locale/": 45,
"./it/build_format_locale/index": 45,
"./it/build_format_locale/index.js": 45,
"./it/index": 98,
"./it/index.js": 98,
"./it/package": 178,
"./it/package.json": 178,
"./ja": 99,
"./ja/": 99,
"./ja/build_distance_in_words_locale": 46,
"./ja/build_distance_in_words_locale/": 46,
"./ja/build_distance_in_words_locale/index": 46,
"./ja/build_distance_in_words_locale/index.js": 46,
"./ja/build_format_locale": 47,
"./ja/build_format_locale/": 47,
"./ja/build_format_locale/index": 47,
"./ja/build_format_locale/index.js": 47,
"./ja/index": 99,
"./ja/index.js": 99,
"./ja/package": 179,
"./ja/package.json": 179,
"./ko": 100,
"./ko/": 100,
"./ko/build_distance_in_words_locale": 48,
"./ko/build_distance_in_words_locale/": 48,
"./ko/build_distance_in_words_locale/index": 48,
"./ko/build_distance_in_words_locale/index.js": 48,
"./ko/build_format_locale": 49,
"./ko/build_format_locale/": 49,
"./ko/build_format_locale/index": 49,
"./ko/build_format_locale/index.js": 49,
"./ko/index": 100,
"./ko/index.js": 100,
"./ko/package": 180,
"./ko/package.json": 180,
"./mk": 101,
"./mk/": 101,
"./mk/build_distance_in_words_locale": 50,
"./mk/build_distance_in_words_locale/": 50,
"./mk/build_distance_in_words_locale/index": 50,
"./mk/build_distance_in_words_locale/index.js": 50,
"./mk/build_format_locale": 51,
"./mk/build_format_locale/": 51,
"./mk/build_format_locale/index": 51,
"./mk/build_format_locale/index.js": 51,
"./mk/index": 101,
"./mk/index.js": 101,
"./mk/package": 181,
"./mk/package.json": 181,
"./nb": 102,
"./nb/": 102,
"./nb/build_distance_in_words_locale": 52,
"./nb/build_distance_in_words_locale/": 52,
"./nb/build_distance_in_words_locale/index": 52,
"./nb/build_distance_in_words_locale/index.js": 52,
"./nb/build_format_locale": 53,
"./nb/build_format_locale/": 53,
"./nb/build_format_locale/index": 53,
"./nb/build_format_locale/index.js": 53,
"./nb/index": 102,
"./nb/index.js": 102,
"./nb/package": 182,
"./nb/package.json": 182,
"./nl": 103,
"./nl/": 103,
"./nl/build_distance_in_words_locale": 54,
"./nl/build_distance_in_words_locale/": 54,
"./nl/build_distance_in_words_locale/index": 54,
"./nl/build_distance_in_words_locale/index.js": 54,
"./nl/build_format_locale": 55,
"./nl/build_format_locale/": 55,
"./nl/build_format_locale/index": 55,
"./nl/build_format_locale/index.js": 55,
"./nl/index": 103,
"./nl/index.js": 103,
"./nl/package": 183,
"./nl/package.json": 183,
"./package": 184,
"./package.json": 184,
"./pl": 104,
"./pl/": 104,
"./pl/build_distance_in_words_locale": 56,
"./pl/build_distance_in_words_locale/": 56,
"./pl/build_distance_in_words_locale/index": 56,
"./pl/build_distance_in_words_locale/index.js": 56,
"./pl/build_format_locale": 57,
"./pl/build_format_locale/": 57,
"./pl/build_format_locale/index": 57,
"./pl/build_format_locale/index.js": 57,
"./pl/index": 104,
"./pl/index.js": 104,
"./pl/package": 185,
"./pl/package.json": 185,
"./pt": 105,
"./pt/": 105,
"./pt/build_distance_in_words_locale": 58,
"./pt/build_distance_in_words_locale/": 58,
"./pt/build_distance_in_words_locale/index": 58,
"./pt/build_distance_in_words_locale/index.js": 58,
"./pt/build_format_locale": 59,
"./pt/build_format_locale/": 59,
"./pt/build_format_locale/index": 59,
"./pt/build_format_locale/index.js": 59,
"./pt/index": 105,
"./pt/index.js": 105,
"./pt/package": 186,
"./pt/package.json": 186,
"./ro": 106,
"./ro/": 106,
"./ro/build_distance_in_words_locale": 60,
"./ro/build_distance_in_words_locale/": 60,
"./ro/build_distance_in_words_locale/index": 60,
"./ro/build_distance_in_words_locale/index.js": 60,
"./ro/build_format_locale": 61,
"./ro/build_format_locale/": 61,
"./ro/build_format_locale/index": 61,
"./ro/build_format_locale/index.js": 61,
"./ro/index": 106,
"./ro/index.js": 106,
"./ro/package": 187,
"./ro/package.json": 187,
"./ru": 107,
"./ru/": 107,
"./ru/build_distance_in_words_locale": 62,
"./ru/build_distance_in_words_locale/": 62,
"./ru/build_distance_in_words_locale/index": 62,
"./ru/build_distance_in_words_locale/index.js": 62,
"./ru/build_format_locale": 63,
"./ru/build_format_locale/": 63,
"./ru/build_format_locale/index": 63,
"./ru/build_format_locale/index.js": 63,
"./ru/index": 107,
"./ru/index.js": 107,
"./ru/package": 188,
"./ru/package.json": 188,
"./sk": 108,
"./sk/": 108,
"./sk/build_distance_in_words_locale": 64,
"./sk/build_distance_in_words_locale/": 64,
"./sk/build_distance_in_words_locale/index": 64,
"./sk/build_distance_in_words_locale/index.js": 64,
"./sk/build_format_locale": 65,
"./sk/build_format_locale/": 65,
"./sk/build_format_locale/index": 65,
"./sk/build_format_locale/index.js": 65,
"./sk/index": 108,
"./sk/index.js": 108,
"./sk/package": 189,
"./sk/package.json": 189,
"./sl": 109,
"./sl/": 109,
"./sl/build_distance_in_words_locale": 66,
"./sl/build_distance_in_words_locale/": 66,
"./sl/build_distance_in_words_locale/index": 66,
"./sl/build_distance_in_words_locale/index.js": 66,
"./sl/build_format_locale": 67,
"./sl/build_format_locale/": 67,
"./sl/build_format_locale/index": 67,
"./sl/build_format_locale/index.js": 67,
"./sl/index": 109,
"./sl/index.js": 109,
"./sl/package": 190,
"./sl/package.json": 190,
"./sv": 110,
"./sv/": 110,
"./sv/build_distance_in_words_locale": 68,
"./sv/build_distance_in_words_locale/": 68,
"./sv/build_distance_in_words_locale/index": 68,
"./sv/build_distance_in_words_locale/index.js": 68,
"./sv/build_format_locale": 69,
"./sv/build_format_locale/": 69,
"./sv/build_format_locale/index": 69,
"./sv/build_format_locale/index.js": 69,
"./sv/index": 110,
"./sv/index.js": 110,
"./sv/package": 191,
"./sv/package.json": 191,
"./th": 111,
"./th/": 111,
"./th/build_distance_in_words_locale": 70,
"./th/build_distance_in_words_locale/": 70,
"./th/build_distance_in_words_locale/index": 70,
"./th/build_distance_in_words_locale/index.js": 70,
"./th/build_format_locale": 71,
"./th/build_format_locale/": 71,
"./th/build_format_locale/index": 71,
"./th/build_format_locale/index.js": 71,
"./th/index": 111,
"./th/index.js": 111,
"./th/package": 192,
"./th/package.json": 192,
"./tr": 112,
"./tr/": 112,
"./tr/build_distance_in_words_locale": 72,
"./tr/build_distance_in_words_locale/": 72,
"./tr/build_distance_in_words_locale/index": 72,
"./tr/build_distance_in_words_locale/index.js": 72,
"./tr/build_format_locale": 73,
"./tr/build_format_locale/": 73,
"./tr/build_format_locale/index": 73,
"./tr/build_format_locale/index.js": 73,
"./tr/index": 112,
"./tr/index.js": 112,
"./tr/package": 193,
"./tr/package.json": 193,
"./zh_cn": 113,
"./zh_cn/": 113,
"./zh_cn/build_distance_in_words_locale": 74,
"./zh_cn/build_distance_in_words_locale/": 74,
"./zh_cn/build_distance_in_words_locale/index": 74,
"./zh_cn/build_distance_in_words_locale/index.js": 74,
"./zh_cn/build_format_locale": 75,
"./zh_cn/build_format_locale/": 75,
"./zh_cn/build_format_locale/index": 75,
"./zh_cn/build_format_locale/index.js": 75,
"./zh_cn/index": 113,
"./zh_cn/index.js": 113,
"./zh_cn/package": 194,
"./zh_cn/package.json": 194,
"./zh_tw": 114,
"./zh_tw/": 114,
"./zh_tw/build_distance_in_words_locale": 76,
"./zh_tw/build_distance_in_words_locale/": 76,
"./zh_tw/build_distance_in_words_locale/index": 76,
"./zh_tw/build_distance_in_words_locale/index.js": 76,
"./zh_tw/build_format_locale": 77,
"./zh_tw/build_format_locale/": 77,
"./zh_tw/build_format_locale/index": 77,
"./zh_tw/build_format_locale/index.js": 77,
"./zh_tw/index": 114,
"./zh_tw/index.js": 114,
"./zh_tw/package": 195,
"./zh_tw/package.json": 195
};
function webpackContext(req) {
return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
var id = map[req];
if(!(id + 1)) // check for number or string
throw new Error("Cannot find module '" + req + "'.");
return id;
};
webpackContext.keys = function webpackContextKeys() {
return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 304;
/***/ }),
/* 305 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(306);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(307);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var BULMA_CAROUSEL_EVENTS = {
'ready': 'carousel:ready',
'slideBefore': 'carousel:slide:before',
'slideAfter': 'carousel:slide:after'
};
var onSwipeStart = Symbol('onSwipeStart');
var onSwipeMove = Symbol('onSwipeMove');
var onSwipeEnd = Symbol('onSwipeEnd');
var supportsPassive = false;
try {
var opts = Object.defineProperty({}, 'passive', {
get: function get() {
supportsPassive = true;
}
});
window.addEventListener("testPassive", null, opts);
window.removeEventListener("testPassive", null, opts);
} catch (e) {}
var bulmaCarousel = function (_EventEmitter) {
_inherits(bulmaCarousel, _EventEmitter);
function bulmaCarousel(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaCarousel);
var _this = _possibleConstructorReturn(this, (bulmaCarousel.__proto__ || Object.getPrototypeOf(bulmaCarousel)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
if (_this.element.dataset.autoplay) {
_this.options.autoplay = _this.element.dataset.autoplay;
}
if (_this.element.dataset.delay) {
_this.options.delay = _this.element.dataset.delay;
}
if (_this.element.dataset.size && !_this.element.classList.contains('carousel-animate-fade')) {
_this.options.size = _this.element.dataset.size;
}
if (_this.element.classList.contains('carousel-animate-fade')) {
_this.options.size = 1;
}
_this.forceHiddenNavigation = false;
_this[onSwipeStart] = _this[onSwipeStart].bind(_this);
_this[onSwipeMove] = _this[onSwipeMove].bind(_this);
_this[onSwipeEnd] = _this[onSwipeEnd].bind(_this);
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaCarousel, [{
key: 'init',
/**
* Initiate plugin
* @method init
* @return {void}
*/
value: function init() {
this.container = this.element.querySelector('.carousel-container');
this.items = this.element.querySelectorAll('.carousel-item');
this.currentItem = {
element: this.element,
node: this.element.querySelector('.carousel-item.is-active'),
pos: -1
};
this.currentItem.pos = this.currentItem.node ? Array.from(this.items).indexOf(this.currentItem.node) : -1;
if (!this.currentItem.node) {
this.currentItem.node = this.items[0];
this.currentItem.node.classList.add('is-active');
this.currentItem.pos = 0;
}
this.forceHiddenNavigation = this.items.length <= 1;
var images = this.element.querySelectorAll('img');
[].forEach.call(images, function (img) {
img.setAttribute('draggable', false);
});
this._resize();
this._setOrder();
this._initNavigation();
this._bindEvents();
if (this.options.autoplay) {
this._autoPlay(this.options.delay);
}
this.emit(BULMA_CAROUSEL_EVENTS.ready, this.currentItem);
}
}, {
key: '_resize',
value: function _resize() {
var _this2 = this;
var computedStyle = window.getComputedStyle(this.element);
var width = parseInt(computedStyle.getPropertyValue('width'), 10);
// Detect which animation is setup and auto-calculate size and transformation
if (this.options.size > 1) {
if (this.options.size >= Array.from(this.items).length) {
this.offset = 0;
} else {
this.offset = width / this.options.size;
}
this.container.style.left = 0 - this.offset + 'px';
this.container.style.transform = 'translateX(' + this.offset + 'px)';
[].forEach.call(this.items, function (item) {
item.style.flexBasis = _this2.offset + 'px';
});
}
// If animation is fade then force carouselContainer size (due to the position: absolute)
if (this.element.classList.contains('carousel-animate-fade') && this.items.length) {
var img = this.items[0].querySelector('img');
var scale = 1;
if (img.naturalWidth) {
scale = width / img.naturalWidth;
this.container.style.height = img.naturalHeight * scale + 'px';
} else {
img.onload = function () {
scale = width / img.naturalWidth;
_this2.container.style.height = img.naturalHeight * scale + 'px';
};
}
}
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
var _this3 = this;
if (this.previousControl) {
this._clickEvents.forEach(function (clickEvent) {
_this3.previousControl.addEventListener(clickEvent, function (e) {
if (!supportsPassive) {
e.preventDefault();
}
if (_this3._autoPlayInterval) {
clearInterval(_this3._autoPlayInterval);
_this3._autoPlay(_this3.optionsdelay);
}
_this3._slide('previous');
}, supportsPassive ? { passive: true } : false);
});
}
if (this.nextControl) {
this._clickEvents.forEach(function (clickEvent) {
_this3.nextControl.addEventListener(clickEvent, function (e) {
if (!supportsPassive) {
e.preventDefault();
}
if (_this3._autoPlayInterval) {
clearInterval(_this3._autoPlayInterval);
_this3._autoPlay(_this3.options.delay);
}
_this3._slide('next');
}, supportsPassive ? { passive: true } : false);
});
}
// Bind swipe events
this.element.addEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false);
this.element.addEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false);
this.element.addEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false);
this.element.addEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false);
this.element.addEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false);
this.element.addEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false);
}
}, {
key: 'destroy',
value: function destroy() {
this.element.removeEventListener('touchstart', this[onSwipeStart], supportsPassive ? { passive: true } : false);
this.element.removeEventListener('mousedown', this[onSwipeStart], supportsPassive ? { passive: true } : false);
this.element.removeEventListener('touchmove', this[onSwipeMove], supportsPassive ? { passive: true } : false);
this.element.removeEventListener('mousemove', this[onSwipeMove], supportsPassive ? { passive: true } : false);
this.element.removeEventListener('touchend', this[onSwipeEnd], supportsPassive ? { passive: true } : false);
this.element.removeEventListener('mouseup', this[onSwipeEnd], supportsPassive ? { passive: true } : false);
}
/**
* Save current position on start swiping
* @method onSwipeStart
* @param {Event} e Swipe event
* @return {void}
*/
}, {
key: onSwipeStart,
value: function value(e) {
if (!supportsPassive) {
e.preventDefault();
}
e = e ? e : window.event;
e = 'changedTouches' in e ? e.changedTouches[0] : e;
this._touch = {
start: {
time: new Date().getTime(), // record time when finger first makes contact with surface
x: e.pageX,
y: e.pageY
},
dist: {
x: 0,
y: 0
}
};
}
/**
* Save current position on end swiping
* @method onSwipeMove
* @param {Event} e swipe event
* @return {void}
*/
}, {
key: onSwipeMove,
value: function value(e) {
if (!supportsPassive) {
e.preventDefault();
}
}
/**
* Save current position on end swiping
* @method onSwipeEnd
* @param {Event} e swipe event
* @return {void}
*/
}, {
key: onSwipeEnd,
value: function value(e) {
if (!supportsPassive) {
e.preventDefault();
}
e = e ? e : window.event;
e = 'changedTouches' in e ? e.changedTouches[0] : e;
this._touch.dist = {
x: e.pageX - this._touch.start.x, // get horizontal dist traveled by finger while in contact with surface
y: e.pageY - this._touch.start.y // get vertical dist traveled by finger while in contact with surface
};
this._handleGesture();
}
/**
* Identify the gestureand slide if necessary
* @method _handleGesture
* @return {void}
*/
}, {
key: '_handleGesture',
value: function _handleGesture() {
var elapsedTime = new Date().getTime() - this._touch.start.time; // get time elapsed
if (elapsedTime <= this.options.allowedTime) {
// first condition for awipe met
if (Math.abs(this._touch.dist.x) >= this.options.threshold && Math.abs(this._touch.dist.y) <= this.options.restraint) {
// 2nd condition for horizontal swipe met
this._touch.dist.x < 0 ? this._slide('next') : this._slide('previous'); // if dist traveled is negative, it indicates left swipe
}
}
}
/**
* Initiate Navigation area and Previous/Next buttons
* @method _initNavigation
* @return {[type]} [description]
*/
}, {
key: '_initNavigation',
value: function _initNavigation() {
this.previousControl = this.element.querySelector('.carousel-nav-left');
this.nextControl = this.element.querySelector('.carousel-nav-right');
if (this.items.length <= 1 || this.forceHiddenNavigation) {
if (this.container) {
this.container.style.left = '0';
}
if (this.previousControl) {
this.previousControl.style.display = 'none';
}
if (this.nextControl) {
this.nextControl.style.display = 'none';
}
}
}
/**
* Update each item order
* @method _setOrder
*/
}, {
key: '_setOrder',
value: function _setOrder() {
this.currentItem.node.style.order = '1';
this.currentItem.node.style.zIndex = '1';
var item = this.currentItem.node;
var i = void 0,
j = void 0,
ref = void 0;
for (i = j = 2, ref = Array.from(this.items).length; 2 <= ref ? j <= ref : j >= ref; i = 2 <= ref ? ++j : --j) {
item = this._next(item);
item.style.order = '' + i % Array.from(this.items).length;
item.style.zIndex = '0';
}
}
/**
* Find next item to display
* @method _next
* @param {Node} element Current Node element
* @return {Node} Next Node element
*/
}, {
key: '_next',
value: function _next(element) {
if (element.nextElementSibling) {
return element.nextElementSibling;
} else {
return this.items[0];
}
}
/**
* Find previous item to display
* @method _previous
* @param {Node} element Current Node element
* @return {Node} Previous Node element
*/
}, {
key: '_previous',
value: function _previous(element) {
if (element.previousElementSibling) {
return element.previousElementSibling;
} else {
return this.items[this.items.length - 1];
}
}
/**
* Update slides to display the wanted one
* @method _slide
* @param {String} [direction='next'] Direction in which items need to move
* @return {void}
*/
}, {
key: '_slide',
value: function _slide() {
var _this4 = this;
var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'next';
if (this.items.length) {
this.oldItemNode = this.currentItem.node;
this.emit(BULMA_CAROUSEL_EVENTS.slideBefore, this.currentItem);
// initialize direction to change order
if (direction === 'previous') {
this.currentItem.node = this._previous(this.currentItem.node);
// add reverse class
if (!this.element.classList.contains('carousel-animate-fade')) {
this.element.classList.add('is-reversing');
this.container.style.transform = 'translateX(' + -Math.abs(this.offset) + 'px)';
}
} else {
// Reorder items
this.currentItem.node = this._next(this.currentItem.node);
// re_slide reverse class
this.element.classList.remove('is-reversing');
this.container.style.transform = 'translateX(' + Math.abs(this.offset) + 'px)';
}
this.currentItem.node.classList.add('is-active');
this.oldItemNode.classList.remove('is-active');
// Disable transition to instant change order
this.element.classList.remove('carousel-animated');
// Enable transition to animate order 1 to order 2
setTimeout(function () {
_this4.element.classList.add('carousel-animated');
}, 50);
this._setOrder();
this.emit(BULMA_CAROUSEL_EVENTS.slideAfter, this.currentItem);
}
}
/**
* Initiate autoplay system
* @method _autoPlay
* @param {Number} [delay=5000] Delay between slides in milliseconds
* @return {void}
*/
}, {
key: '_autoPlay',
value: function _autoPlay() {
var _this5 = this;
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 5000;
this._autoPlayInterval = setInterval(function () {
_this5._slide('next');
}, delay);
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.carousel, .hero-carousel';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaCarousel(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaCarousel;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaCarousel);
/***/ }),
/* 306 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 307 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {
size: 1,
autoplay: false,
delay: 5000,
threshold: 50, //required min distance traveled to be considered swipe
restraint: 100, // maximum distance allowed at the same time in perpendicular direction
allowedTime: 500 // maximum time allowed to travel that distance
};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 308 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(309);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(310);
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var fetchStyle = function fetchStyle(url) {
return new Promise(function (resolve, reject) {
var link = document.createElement('link');
link.type = 'text/css';
link.rel = 'stylesheet';
link.onload = function () {
resolve();
};
link.href = url;
if (!document.querySelector('link[href="' + url + '"]')) {
var headScript = document.querySelector('head');
headScript.append(link);
}
});
};
var bulmaIconpicker = function (_EventEmitter) {
_inherits(bulmaIconpicker, _EventEmitter);
function bulmaIconpicker(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaIconpicker);
var _this = _possibleConstructorReturn(this, (bulmaIconpicker.__proto__ || Object.getPrototypeOf(bulmaIconpicker)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
_this.icons = [];
_this.id = 'iconPicker' + new Date().getTime();
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaIconpicker, [{
key: 'init',
value: function init() {
var _this2 = this;
this.createModal();
this.createPreview();
this.options.iconSets.forEach(function (iconSet) {
fetchStyle(iconSet.css);
// Parse CSS file to get array of all available icons
fetch(iconSet.css, { mode: 'cors' }).then(function (res) {
return res.text();
}).then(function (css) {
_this2.icons[iconSet.name] = _this2.parseCSS(css, iconSet.prefix || 'fa-', iconSet.displayPrefix || '');
_this2.modalSetTabs.querySelector('a').click();
var touchEvent = new Event('touchstart');
_this2.modalSetTabs.querySelector('a').dispatchEvent(touchEvent);
});
});
}
}, {
key: 'createPreview',
value: function createPreview() {
var _this3 = this;
this.preview = document.createElement('div');
this.preview.className = 'icon is-large';
this.preview.classList.add('iconpicker-preview');
var iconPreview = document.createElement('i');
iconPreview.className = 'iconpicker-icon-preview';
if (this.element.value.length) {
var classes = this.element.value.split(' ');
classes.forEach(function (cls) {
iconPreview.classList.add(cls);
});
}
this.preview.appendChild(iconPreview);
this._clickEvents.forEach(function (event) {
_this3.preview.addEventListener(event, function (e) {
e.preventDefault();
_this3.modal.classList.add('is-active');
});
});
this.element.parentNode.insertBefore(this.preview, this.element.nextSibling);
}
}, {
key: 'parseCSS',
value: function parseCSS(css) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'fa-';
var displayPrefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var iconPattern = new RegExp('\\.' + prefix + '([^\\.!:]*)::?before\\s*{\\s*content:\\s*["|\']\\\\[^\'|"]*["|\'];?\\s*}', 'g');
var index = 1;
var icons = [],
icon = void 0,
match = void 0;
while (match = iconPattern.exec(css)) {
icon = {
prefix: prefix,
selector: prefix + match[index].trim(':'),
name: this.ucwords(match[index]).trim(':'),
filter: match[index].trim(':'),
displayPrefix: displayPrefix
};
icons[match[index]] = icon;
}
if (Object.getOwnPropertyNames(this.icons).length == 0) {
console.warn("No icons found in CSS file");
}
return icons;
}
}, {
key: 'ucwords',
value: function ucwords(str) {
return (str + '').replace(/^(.)|\s+(.)/g, function ($1) {
return $1.toUpperCase();
});
}
}, {
key: 'drawIcons',
value: function drawIcons(iconSet) {
this.iconsList.innerHTML = '';
if (iconSet) {
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = Object.entries(iconSet)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var _ref = _step.value;
var _ref2 = _slicedToArray(_ref, 2);
var iconName = _ref2[0];
var icon = _ref2[1];
this.iconsList.appendChild(this.createIconPreview(icon));
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
}
}, {
key: 'createIconPreview',
value: function createIconPreview(icon) {
var _this4 = this;
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'fa-';
var iconLink = document.createElement('a');
iconLink.dataset.title = icon['name'];
iconLink.setAttribute('title', icon['name']);
iconLink.dataset.icon = icon['selector'];
iconLink.dataset.filter = icon['filter'];
var iconPreview = document.createElement('i');
iconPreview.className = 'iconpicker-icon-preview';
if (icon['displayPrefix'].length) {
prefix = icon['displayPrefix'].split(' ');
prefix.forEach(function (pfx) {
iconPreview.classList.add(pfx);
});
}
iconPreview.classList.add(icon['selector']);
iconLink.appendChild(iconPreview);
this._clickEvents.forEach(function (event) {
iconLink.addEventListener(event, function (e) {
e.preventDefault();
_this4.preview.innerHTML = '';
_this4.element.value = e.target.classList;
_this4.element.dispatchEvent(new Event('change'));
_this4.preview.appendChild(e.target.cloneNode(true));
_this4.modal.classList.remove('is-active');
});
});
return iconLink;
}
}, {
key: 'createModal',
value: function createModal() {
var _this5 = this;
this.modal = document.createElement('div');
this.modal.className = 'modal';
this.modal.classList.add('iconpicker-modal');
this.modal.id = this.id;
var modalBackground = document.createElement('div');
modalBackground.className = 'modal-background';
var modalCard = document.createElement('div');
modalCard.className = 'modal-card';
var modalHeader = document.createElement('header');
modalHeader.className = 'modal-card-head';
var modalHeaderTitle = document.createElement('p');
modalHeaderTitle.className = 'modal-card-title';
modalHeaderTitle.innerHTML = 'iconPicker';
this.modalHeaderSearch = document.createElement('input');
this.modalHeaderSearch.setAttribute('type', 'search');
this.modalHeaderSearch.setAttribute('placeholder', 'Search');
this.modalHeaderSearch.className = 'iconpicker-search';
this.modalHeaderSearch.addEventListener('input', function (e) {
_this5.filter(e.target.value);
});
var modalHeaderClose = document.createElement('button');
modalHeaderClose.className = 'delete';
this._clickEvents.forEach(function (event) {
modalHeaderClose.addEventListener(event, function (e) {
e.preventDefault();
_this5.modal.classList.remove('is-active');
});
});
modalCard.appendChild(modalHeader);
this.modalBody = document.createElement('section');
this.modalBody.className = 'modal-card-body';
if (this.options.iconSets.length >= 1) {
var modalSets = document.createElement('div');
modalSets.className = 'iconpicker-sets';
modalSets.classList.add('tabs');
this.modalSetTabs = document.createElement('ul');
this.options.iconSets.forEach(function (iconSet) {
var modalSetTab = document.createElement('li');
var modalSetTabLink = document.createElement('a');
modalSetTabLink.dataset.iconset = iconSet.name;
modalSetTabLink.innerHTML = iconSet.name;
_this5._clickEvents.forEach(function (event) {
modalSetTabLink.addEventListener(event, function (e) {
e.preventDefault();
var activeModalTabs = _this5.modalSetTabs.querySelectorAll('.is-active');
[].forEach.call(activeModalTabs, function (activeModalTab) {
activeModalTab.classList.remove('is-active');
});
e.target.parentNode.classList.add('is-active');
_this5.drawIcons(_this5.icons[e.target.dataset.iconset]);
_this5.filter(_this5.modalHeaderSearch.value);
});
});
modalSetTab.appendChild(modalSetTabLink);
_this5.modalSetTabs.appendChild(modalSetTab);
});
modalSets.appendChild(this.modalSetTabs);
modalCard.appendChild(modalSets);
}
this.iconsList = document.createElement('div');
this.iconsList.className = 'iconpicker-icons';
modalHeader.appendChild(modalHeaderTitle);
modalHeader.appendChild(this.modalHeaderSearch);
modalHeader.appendChild(modalHeaderClose);
this.modalBody.appendChild(this.iconsList);
modalCard.appendChild(this.modalBody);
this.modal.appendChild(modalBackground);
this.modal.appendChild(modalCard);
document.body.appendChild(this.modal);
}
}, {
key: 'filter',
value: function filter() {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
if (value === '') {
this.iconsList.querySelectorAll('[data-filter]').forEach(function (el) {
el.classList.remove('is-hidden');
});
return;
}
this.iconsList.querySelectorAll('[data-filter]').forEach(function (el) {
el.classList.remove('is-hidden');
});
this.iconsList.querySelectorAll('[data-filter]:not([data-filter*="' + value + '"])').forEach(function (el) {
el.classList.add('is-hidden');
});
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-action="iconPicker"]';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaIconpicker(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaIconpicker;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaIconpicker);
/***/ }),
/* 309 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 310 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {
iconSets: [{
name: 'simpleLine', // Name displayed on tab
css: 'https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css', // CSS url containing icons rules
prefix: 'icon-', // CSS rules prefix to identify icons
displayPrefix: ''
}, {
name: 'fontAwesome', // Name displayed on tab
css: 'https://use.fontawesome.com/releases/v5.0.13/css/all.css', // CSS url containing icons rules
prefix: 'fa-', // CSS rules prefix to identify icons
displayPrefix: 'fas fa-icon'
}]
};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 311 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(312);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(313);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var onQuickviewShowClick = Symbol('onQuickviewShowClick');
var onQuickviewDismissClick = Symbol('onQuickviewDismissClick');
var bulmaQuickview = function (_EventEmitter) {
_inherits(bulmaQuickview, _EventEmitter);
function bulmaQuickview(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaQuickview);
var _this = _possibleConstructorReturn(this, (bulmaQuickview.__proto__ || Object.getPrototypeOf(bulmaQuickview)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
_this[onQuickviewShowClick] = _this[onQuickviewShowClick].bind(_this);
_this[onQuickviewDismissClick] = _this[onQuickviewDismissClick].bind(_this);
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaQuickview, [{
key: 'init',
/**
* Initiate plugin
* @method init
* @return {void}
*/
value: function init() {
this.quickview = document.getElementById(this.element.dataset['target']);
this.dismissElements = document.querySelectorAll('[data-dismiss="quickview"]');
this._bindEvents();
this.emit('quickview:ready', {
element: this.element,
quickview: this.quickview
});
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
var _this2 = this;
this._clickEvents.forEach(function (event) {
_this2.element.addEventListener(event, _this2[onQuickviewShowClick], false);
});
[].forEach.call(this.dismissElements, function (dismissElement) {
_this2._clickEvents.forEach(function (event) {
dismissElement.addEventListener(event, _this2[onQuickviewDismissClick], false);
});
});
}
}, {
key: onQuickviewShowClick,
value: function value(e) {
this.quickview.classList.add('is-active');
this.emit('quickview:show', {
element: this.element,
quickview: this.quickview
});
}
}, {
key: onQuickviewDismissClick,
value: function value(e) {
this.quickview.classList.remove('is-active');
this.emit('quickview:hide', {
element: this.element,
quickview: this.quickview
});
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-show="quickview"]';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaQuickview(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaQuickview;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaQuickview);
/***/ }),
/* 312 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 313 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 314 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(315);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(316);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var onSliderInput = Symbol('onSliderInput');
var bulmaSlider = function (_EventEmitter) {
_inherits(bulmaSlider, _EventEmitter);
function bulmaSlider(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaSlider);
var _this = _possibleConstructorReturn(this, (bulmaSlider.__proto__ || Object.getPrototypeOf(bulmaSlider)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
_this[onSliderInput] = _this[onSliderInput].bind(_this);
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaSlider, [{
key: 'init',
/**
* Initiate plugin
* @method init
* @return {void}
*/
value: function init() {
this._id = 'bulmaSlider' + new Date().getTime() + Math.floor(Math.random() * Math.floor(9999));
this.output = this._findOutputForSlider();
if (this.output) {
if (this.element.classList.contains('has-output-tooltip')) {
// Get new output position
var newPosition = this._getSliderOutputPosition();
// Set output position
this.output.style['left'] = newPosition.position;
}
}
this.emit('bulmaslider:ready', this.element.value);
}
}, {
key: '_findOutputForSlider',
value: function _findOutputForSlider() {
var _this2 = this;
var outputs = document.getElementsByTagName('output');
[].forEach.call(outputs, function (output) {
if (output.htmlFor == _this2.element.getAttribute('id')) {
return output;
}
});
return null;
}
}, {
key: '_getSliderOutputPosition',
value: function _getSliderOutputPosition() {
// Update output position
var newPlace, minValue;
var style = window.getComputedStyle(this.element, null);
// Measure width of range input
var sliderWidth = parseInt(style.getPropertyValue('width'), 10);
// Figure out placement percentage between left and right of input
if (!this.element.getAttribute('min')) {
minValue = 0;
} else {
minValue = this.element.getAttribute('min');
}
var newPoint = (this.element.value - minValue) / (this.element.getAttribute('max') - minValue);
// Prevent bubble from going beyond left or right (unsupported browsers)
if (newPoint < 0) {
newPlace = 0;
} else if (newPoint > 1) {
newPlace = sliderWidth;
} else {
newPlace = sliderWidth * newPoint;
}
return {
'position': newPlace + 'px'
};
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
if (this.output) {
// Add event listener to update output when slider value change
this.element.addEventListener('input', this[onSliderInput], false);
}
}
}, {
key: onSliderInput,
value: function value(e) {
e.preventDefault();
if (this.element.classList.contains('has-output-tooltip')) {
// Get new output position
var newPosition = this._getSliderOutputPosition();
// Set output position
this.output.style['left'] = newPosition.position;
}
// Check for prefix and postfix
var prefix = this.output.hasAttribute('data-prefix') ? this.output.getAttribute('data-prefix') : '';
var postfix = this.output.hasAttribute('data-postfix') ? this.output.getAttribute('data-postfix') : '';
// Update output with slider value
this.output.value = prefix + this.element.value + postfix;
this.emit('bulmaslider:ready', this.element.value);
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'input[type="range"].slider';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaSlider(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaSlider;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaSlider);
/***/ }),
/* 315 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 316 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 317 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__events__ = __webpack_require__(318);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(319);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var onStepsPrevious = Symbol('onStepsPrevious');
var onStepsNext = Symbol('onStepsNext');
var bulmaSteps = function (_EventEmitter) {
_inherits(bulmaSteps, _EventEmitter);
function bulmaSteps(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaSteps);
var _this = _possibleConstructorReturn(this, (bulmaSteps.__proto__ || Object.getPrototypeOf(bulmaSteps)).call(this));
_this.element = typeof selector === 'string' ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
_this[onStepsPrevious] = _this[onStepsPrevious].bind(_this);
_this[onStepsNext] = _this[onStepsNext].bind(_this);
_this.init();
return _this;
}
/**
* Initiate all DOM element containing carousel class
* @method
* @return {Array} Array of all Carousel instances
*/
_createClass(bulmaSteps, [{
key: 'init',
/**
* Initiate plugin
* @method init
* @return {void}
*/
value: function init() {
this._id = 'bulmaSteps' + new Date().getTime() + Math.floor(Math.random() * Math.floor(9999));
this.steps = this.element.querySelectorAll(this.options.selector);
this.contents = this.element.querySelectorAll(this.options.selector_content);
this.previous_btn = this.element.querySelector(this.options.previous_selector);
this.next_btn = this.element.querySelector(this.options.next_selector);
[].forEach.call(this.steps, function (step, index) {
step.setAttribute('data-step-id', index);
});
if (this.steps && this.steps.length) {
this.activate_step(0);
this.updateActions(this.steps[0]);
}
this._bindEvents();
this.emit('bulmasteps:ready', this.element.value);
}
/**
* Bind all events
* @method _bindEvents
* @return {void}
*/
}, {
key: '_bindEvents',
value: function _bindEvents() {
var _this2 = this;
if (this.previous_btn != null) {
this._clickEvents.forEach(function (event) {
_this2.previous_btn.addEventListener(event, _this2[onStepsPrevious], false);
});
}
if (this.next_btn != null) {
this._clickEvents.forEach(function (event) {
_this2.next_btn.addEventListener(event, _this2[onStepsNext], false);
});
}
if (this.options.stepClickable) {
[].forEach.call(this.steps, function (step, index) {
_this2._clickEvents.forEach(function (event) {
while (index > _this2.current_id) {
_this2[onStepsNext](event);
}
while (index < _this2.current_id) {
_this2[onStepsPrevious](event);
}
});
});
}
}
}, {
key: onStepsPrevious,
value: function value(e) {
e.preventDefault();
if (!e.target.getAttribute('disabled')) {
this.previous_step();
}
}
}, {
key: onStepsNext,
value: function value(e) {
e.preventDefault();
if (!e.target.getAttribute('disabled')) {
this.next_step();
}
}
}, {
key: 'get_current_step_id',
value: function get_current_step_id() {
for (var i = 0; i < this.steps.length; i++) {
var step = this.steps[i];
if (step.classList.contains(this.options.active_class)) {
return parseInt(step.getAttribute('data-step-id'));
}
}
return null;
}
}, {
key: 'updateActions',
value: function updateActions(step) {
var stepId = parseInt(step.getAttribute('data-step-id'));
if (stepId == 0) {
if (this.previous_btn != null) {
this.previous_btn.setAttribute('disabled', 'disabled');
}
if (this.next_btn != null) {
this.next_btn.removeAttribute('disabled', 'disabled');
}
} else if (stepId == this.steps.length - 1) {
if (this.previous_btn != null) {
this.previous_btn.removeAttribute('disabled', 'disabled');
}
if (this.next_btn != null) {
this.next_btn.setAttribute('disabled', 'disabled');
}
} else {
if (this.previous_btn != null) {
this.previous_btn.removeAttribute('disabled', 'disabled');
}
if (this.next_btn != null) {
this.next_btn.removeAttribute('disabled', 'disabled');
}
}
}
}, {
key: 'next_step',
value: function next_step() {
var current_id = this.get_current_step_id();
if (current_id == null) {
return;
}
var next_id = current_id + 1,
errors = [];
if (typeof this.options.beforeNext != 'undefined' && this.options.beforeNext != null && this.options.beforeNext) {
errors = this.options.beforeNext(current_id);
}
this.emit('bulmasteps:before:next', current_id);
if (typeof errors == 'undefined') {
errors = [];
}
if (errors.length > 0) {
this.emit('bulmasteps:errors', errors);
for (var i = 0; i < errors.length; i++) {
if (typeof this.options.onError != 'undefined' && this.options.onError != null && this.options.onError) {
this.options.onError(errors[i]);
}
}
return;
}
if (next_id >= this.steps.length - 1) {
if (typeof this.options.onFinish != 'undefined' && this.options.onFinish != null && this.options.onFinish) {
this.options.onFinish(current_id);
}
this.emit('bulmasteps:finish', current_id);
}
if (next_id < this.steps.length) {
this.complete_step(current_id);
this.activate_step(next_id);
}
}
}, {
key: 'previous_step',
value: function previous_step() {
var current_id = this.get_current_step_id();
if (current_id == null) {
return;
}
this.uncomplete_step(current_id - 1);
this.activate_step(current_id - 1);
}
/**
* Activate a single step,
* will deactivate all other steps.
*/
}, {
key: 'activate_step',
value: function activate_step(step_id) {
this.updateActions(this.steps[step_id]);
for (var i = 0; i < this.steps.length; i++) {
var _step = this.steps[i];
if (_step == this.steps[step_id]) {
continue;
}
this.deactivate_step(i);
}
this.steps[step_id].classList.add(this.options.active_class);
if (typeof this.contents[step_id] !== 'undefined') {
this.contents[step_id].classList.add(this.options.active_class);
}
if (typeof this.options.onShow != 'undefined' && this.options.onShow != null && this.options.onShow) {
this.options.onShow(step_id);
}
this.emit('bulmasteps:step:show', step_id);
}
}, {
key: 'complete_step',
value: function complete_step(step_id) {
this.steps[step_id].classList.add(this.options.completed_class);
this.emit('bulmasteps:step:completed', step_id);
}
}, {
key: 'uncomplete_step',
value: function uncomplete_step(step_id) {
this.steps[step_id].classList.remove(this.options.completed_class);
this.emit('bulmasteps:step:uncompleted', step_id);
}
}, {
key: 'deactivate_step',
value: function deactivate_step(step_id) {
this.steps[step_id].classList.remove(this.options.active_class);
if (typeof this.contents[step_id] !== 'undefined') {
this.contents[step_id].classList.remove(this.options.active_class);
}
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '.steps';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaSteps(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaSteps;
}(__WEBPACK_IMPORTED_MODULE_0__events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaSteps);
/***/ }),
/* 318 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 319 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {
'selector': '.step-item',
'selector_content': '.step-content',
'previous_selector': '[data-nav="previous"]',
'next_selector': '[data-nav="next"]',
'active_class': 'is-active',
'completed_class': 'is-completed',
'stepClickable': false,
'beforeNext': null,
'onShow': null,
'onFinish': null,
'onError': null
};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 320 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_events__ = __webpack_require__(321);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__defaultOptions__ = __webpack_require__(322);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_type__ = __webpack_require__(323);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var KEY_BACKSPACE = 8,
KEY_TAB = 9,
KEY_ENTER = 13,
KEY_LEFT = 37,
KEY_RIGHT = 39,
KEY_DELETE = 46,
KEY_COMMA = 188;
var bulmaTagsinput = function (_EventEmitter) {
_inherits(bulmaTagsinput, _EventEmitter);
function bulmaTagsinput(selector) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, bulmaTagsinput);
var _this = _possibleConstructorReturn(this, (bulmaTagsinput.__proto__ || Object.getPrototypeOf(bulmaTagsinput)).call(this));
_this.element = __WEBPACK_IMPORTED_MODULE_2__utils_type__["a" /* isString */](selector) ? document.querySelector(selector) : selector;
// An invalid selector or non-DOM node has been provided.
if (!_this.element) {
throw new Error('An invalid selector or non-DOM node has been provided.');
}
_this._clickEvents = ['click'];
/// Set default options and merge with instance defined
_this.options = _extends({}, __WEBPACK_IMPORTED_MODULE_1__defaultOptions__["a" /* default */], options);
if (_this.element.dataset.hasOwnProperty('lowercase')) {
_this.options.lowercase = _this.element.dataset('lowercase');
}
if (_this.element.dataset.hasOwnProperty('uppercase')) {
_this.options.lowercase = _this.element.dataset('uppercase');
}
if (_this.element.dataset.hasOwnProperty('duplicates')) {
_this.options.lowercase = _this.element.dataset('duplicates');
}
_this.init();
return _this;
}
/**
* Initiate all DOM element containing tagsinput class
* @method
* @return {Array} Array of all TagsInput instances
*/
_createClass(bulmaTagsinput, [{
key: 'init',
value: function init() {
if (!this.options.disabled) {
this.tags = [];
// The container will visually looks like an input
this.container = document.createElement('div');
this.container.className = 'tagsinput';
this.container.classList.add('field');
this.container.classList.add('is-grouped');
this.container.classList.add('is-grouped-multiline');
this.container.classList.add('input');
var inputType = this.element.getAttribute('type');
if (!inputType || inputType === 'tags') {
inputType = 'text';
}
// Create an invisible input element so user will be able to enter value
this.input = document.createElement('input');
this.input.setAttribute('type', inputType);
if (this.element.getAttribute('placeholder')) {
this.input.setAttribute('placeholder', this.element.getAttribute('placeholder'));
} else {
this.input.setAttribute('placeholder', 'Add a Tag');
}
this.container.appendChild(this.input);
var sib = this.element.nextSibling;
this.element.parentNode[sib ? 'insertBefore' : 'appendChild'](this.container, sib);
this.element.style.cssText = 'position:absolute;left:0;top:0;width:1px;height:1px;opacity:0.01;';
this.element.tabIndex = -1;
this.enable();
}
}
}, {
key: 'enable',
value: function enable() {
var _this2 = this;
if (!this.enabled && !this.options.disabled) {
this.element.addEventListener('focus', function () {
_this2.container.classList.add('is-focused');
_this2.select(Array.prototype.slice.call(_this2.container.querySelectorAll('.tag:not(.is-delete)')).pop());
});
this.input.addEventListener('focus', function () {
_this2.container.classList.add('is-focused');
_this2.select(Array.prototype.slice.call(_this2.container.querySelectorAll('.tag:not(.is-delete)')).pop());
});
this.input.addEventListener('blur', function () {
_this2.container.classList.remove('is-focused');
_this2.select(Array.prototype.slice.call(_this2.container.querySelectorAll('.tag:not(.is-delete)')).pop());
_this2.savePartial();
});
this.input.addEventListener('keydown', function (e) {
var key = e.charCode || e.keyCode || e.which,
selectedTag = void 0,
activeTag = _this2.container.querySelector('.tag.is-active'),
last = Array.prototype.slice.call(_this2.container.querySelectorAll('.tag:not(.is-delete)')).pop(),
atStart = _this2.caretAtStart(_this2.input);
if (activeTag) {
selectedTag = _this2.container.querySelector('[data-tag="' + activeTag.innerHTML.trim() + '"]');
}
_this2.setInputWidth();
if (key === KEY_ENTER || key === _this2.options.delimiter.charCodeAt(0) || key === KEY_COMMA || key === KEY_TAB) {
if (!_this2.input.value && (key !== _this2.options.delimiter.charCodeAt(0) || key === KEY_COMMA)) {
return;
}
_this2.savePartial();
} else if (key === KEY_DELETE && selectedTag) {
if (selectedTag.nextSibling) {
_this2.select(selectedTag.nextSibling.querySelector('.tag'));
} else if (selectedTag.previousSibling) {
_this2.select(selectedTag.previousSibling.querySelector('.tag'));
}
_this2.container.removeChild(selectedTag);
_this2.tags.splice(_this2.tags.indexOf(selectedTag.getAttribute('data-tag')), 1);
_this2.setInputWidth();
_this2.save();
} else if (key === KEY_BACKSPACE) {
if (selectedTag) {
if (selectedTag.previousSibling) {
_this2.select(selectedTag.previousSibling.querySelector('.tag'));
} else if (selectedTag.nextSibling) {
_this2.select(selectedTag.nextSibling.querySelector('.tag'));
}
_this2.container.removeChild(selectedTag);
_this2.tags.splice(_this2.tags.indexOf(selectedTag.getAttribute('data-tag')), 1);
_this2.setInputWidth();
_this2.save();
} else if (last && atStart) {
_this2.select(last);
} else {
return;
}
} else if (key === KEY_LEFT) {
if (selectedTag) {
if (selectedTag.previousSibling) {
_this2.select(selectedTag.previousSibling.querySelector('.tag'));
}
} else if (!atStart) {
return;
} else {
_this2.select(last);
}
} else if (key === KEY_RIGHT) {
if (!selectedTag) {
return;
}
_this2.select(selectedTag.nextSibling.querySelector('.tag'));
} else {
return _this2.select();
}
e.preventDefault();
return false;
});
this.input.addEventListener('input', function () {
_this2.element.value = _this2.getValue();
_this2.element.dispatchEvent(new Event('input'));
});
this.input.addEventListener('paste', function () {
return setTimeout(savePartial, 0);
});
this.container.addEventListener('mousedown', function (e) {
_this2.refocus(e);
});
this.container.addEventListener('touchstart', function (e) {
_this2.refocus(e);
});
this.savePartial(this.element.value);
this.enabled = true;
}
}
}, {
key: 'disable',
value: function disable() {
if (this.enabled && !this.options.disabled) {
this.reset();
this.enabled = false;
}
}
}, {
key: 'select',
value: function select(el) {
var sel = this.container.querySelector('.is-active');
if (sel) {
sel.classList.remove('is-active');
}
if (el) {
el.classList.add('is-active');
}
}
}, {
key: 'addTag',
value: function addTag(text) {
var _this3 = this;
if (~text.indexOf(this.options.delimiter)) {
text = text.split(this.options.delimiter);
}
if (Array.isArray(text)) {
return text.forEach(function (text) {
_this3.addTag(text);
});
}
var tag = text && text.trim();
if (!tag) {
return false;
}
if (this.options['lowercase'] == 'true') {
tag = tag.toLowerCase();
}
if (this.options['uppercase'] == 'true') {
tag = tag.toUpperCase();
}
if (this.options['duplicates'] || this.tags.indexOf(tag) === -1) {
this.tags.push(tag);
var newTagWrapper = document.createElement('div');
newTagWrapper.className = 'control';
newTagWrapper.setAttribute('data-tag', tag);
var newTag = document.createElement('div');
newTag.className = 'tags';
newTag.classList.add('has-addons');
var newTagContent = document.createElement('span');
newTagContent.className = 'tag';
newTagContent.classList.add('is-active');
this.select(newTagContent);
newTagContent.innerHTML = tag;
newTag.appendChild(newTagContent);
if (this.options.allowDelete) {
var newTagDeleteButton = document.createElement('a');
newTagDeleteButton.className = 'tag';
newTagDeleteButton.classList.add('is-delete');
this._clickEvents.forEach(function (event) {
newTagDeleteButton.addEventListener(event, function (e) {
var selectedTag = void 0,
activeTag = e.target.parentNode,
last = Array.prototype.slice.call(_this3.container.querySelectorAll('.tag')).pop(),
atStart = _this3.caretAtStart(_this3.input);
if (activeTag) {
selectedTag = _this3.container.querySelector('[data-tag="' + activeTag.innerText.trim() + '"]');
}
if (selectedTag) {
_this3.select(selectedTag.previousSibling);
_this3.container.removeChild(selectedTag);
_this3.tags.splice(_this3.tags.indexOf(selectedTag.getAttribute('data-tag')), 1);
_this3.setInputWidth();
_this3.save();
} else if (last && atStart) {
_this3.select(last);
} else {
return;
}
});
});
newTag.appendChild(newTagDeleteButton);
}
newTagWrapper.appendChild(newTag);
this.container.insertBefore(newTagWrapper, this.input);
}
}
}, {
key: 'getValue',
value: function getValue() {
return this.tags.join(this.options.delimiter);
}
}, {
key: 'setValue',
value: function setValue(value) {
var _this4 = this;
Array.prototype.slice.call(this.container.querySelectorAll('.tag')).forEach(function (tag) {
_this4.tags.splice(_this4.tags.indexOf(tag.innerHTML), 1);
_this4.container.removeChild(tag);
});
this.savePartial(value);
}
}, {
key: 'setInputWidth',
value: function setInputWidth() {
var last = Array.prototype.slice.call(this.container.querySelectorAll('.control')).pop();
if (!this.container.offsetWidth) {
return;
}
this.input.style.width = Math.max(this.container.offsetWidth - (last ? last.offsetLeft + last.offsetWidth : 30) - 30, this.container.offsetWidth / 4) + 'px';
}
}, {
key: 'savePartial',
value: function savePartial(value) {
if (typeof value !== 'string' && !Array.isArray(value)) {
value = this.input.value;
}
if (this.addTag(value) !== false) {
this.input.value = '';
this.save();
this.setInputWidth();
}
}
}, {
key: 'save',
value: function save() {
this.element.value = this.tags.join(this.options.delimiter);
this.element.dispatchEvent(new Event('change'));
}
}, {
key: 'caretAtStart',
value: function caretAtStart(el) {
try {
return el.selectionStart === 0 && el.selectionEnd === 0;
} catch (e) {
return el.value === '';
}
}
}, {
key: 'refocus',
value: function refocus(e) {
if (e.target.classList.contains('tag')) {
this.select(e.target);
}
if (e.target === this.input) {
return this.select();
}
this.input.focus();
e.preventDefault();
return false;
}
}, {
key: 'reset',
value: function reset() {
this.tags = [];
}
}, {
key: 'destroy',
value: function destroy() {
this.disable();
this.reset();
this.element = null;
}
}], [{
key: 'attach',
value: function attach() {
var selector = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'input[type="tags"]';
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var instances = new Array();
var elements = document.querySelectorAll(selector);
[].forEach.call(elements, function (element) {
setTimeout(function () {
instances.push(new bulmaTagsinput(element, options));
}, 100);
});
return instances;
}
}]);
return bulmaTagsinput;
}(__WEBPACK_IMPORTED_MODULE_0__utils_events__["a" /* default */]);
/* harmony default export */ __webpack_exports__["a"] = (bulmaTagsinput);
/***/ }),
/* 321 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var EventEmitter = function () {
function EventEmitter() {
var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, EventEmitter);
this._listeners = new Map(listeners);
this._middlewares = new Map();
}
_createClass(EventEmitter, [{
key: "listenerCount",
value: function listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}
var eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}
}, {
key: "removeListeners",
value: function removeListeners() {
var _this = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var middleware = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this.removeListeners(e, middleware);
});
} else {
this._listeners.delete(eventName);
if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}
}, {
key: "middleware",
value: function middleware(eventName, fn) {
var _this2 = this;
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this2.middleware(e, fn);
});
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}
this._middlewares.get(eventName).push(fn);
}
}
}, {
key: "removeMiddleware",
value: function removeMiddleware() {
var _this3 = this;
var eventName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(function (e) {
return _this3.removeMiddleware(e);
});
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}
}, {
key: "on",
value: function on(name, callback) {
var _this4 = this;
var once = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (Array.isArray(name)) {
name.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
name = name.toString();
var split = name.split(/,|, | /);
if (split.length > 1) {
split.forEach(function (e) {
return _this4.on(e, callback);
});
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}
this._listeners.get(name).push({ once: once, callback: callback });
}
}
}
}, {
key: "once",
value: function once(name, callback) {
this.on(name, callback, true);
}
}, {
key: "emit",
value: function emit(name, data) {
var _this5 = this;
var silent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
name = name.toString();
var listeners = this._listeners.get(name);
var middlewares = null;
var doneCount = 0;
var execute = silent;
if (Array.isArray(listeners)) {
listeners.forEach(function (listener, index) {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = _this5._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(function (middleware) {
middleware(data, function () {
var newData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});
if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}
// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});
// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}]);
return EventEmitter;
}();
/* harmony default export */ __webpack_exports__["a"] = (EventEmitter);
/***/ }),
/* 322 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
var defaultOptions = {
disabled: false,
delimiter: ',',
allowDelete: true,
lowercase: false,
uppercase: false,
duplicates: true
};
/* harmony default export */ __webpack_exports__["a"] = (defaultOptions);
/***/ }),
/* 323 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isString; });
/* unused harmony export isDate */
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var isString = function isString(unknown) {
return typeof unknown === 'string' || !!unknown && (typeof unknown === 'undefined' ? 'undefined' : _typeof(unknown)) === 'object' && Object.prototype.toString.call(unknown) === '[object String]';
};
var isDate = function isDate(unknown) {
return (Object.prototype.toString.call(unknown) === '[object Date]' || unknown instanceof Date) && !isNaN(unknown.valueOf());
};
/***/ })
/******/ ])["default"];
});