WordPress.org

Make WordPress Core

Ticket #39222: 39222.2.diff

File 39222.2.diff, 76.3 KB (added by rmccue, 2 years ago)

Updated documentation, and other tweaks

  • src/wp-admin/includes/ajax-actions.php

     
    22282228}
    22292229
    22302230/**
    2231  * Ajax handler for date formatting.
    2232  *
    2233  * @since 3.1.0
    2234  */
    2235 function wp_ajax_date_format() {
    2236         wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) );
    2237 }
    2238 
    2239 /**
    2240  * Ajax handler for time formatting.
    2241  *
    2242  * @since 3.1.0
    2243  */
    2244 function wp_ajax_time_format() {
    2245         wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
    2246 }
    2247 
    2248 /**
    22492231 * Ajax handler for saving posts from the fullscreen editor.
    22502232 *
    22512233 * @since 3.1.0
  • src/wp-admin/includes/deprecated.php

     
    13961396                echo ' autocomplete="off"';
    13971397        }
    13981398}
     1399
     1400/**
     1401 * Ajax handler for date formatting.
     1402 *
     1403 * @since 3.1.0
     1404 */
     1405function wp_ajax_date_format() {
     1406        _deprecated_function( __FUNCTION__, '4.8', 'wp-date.js' );
     1407
     1408        wp_die( date_i18n( sanitize_option( 'date_format', wp_unslash( $_POST['date'] ) ) ) );
     1409}
     1410
     1411/**
     1412 * Ajax handler for time formatting.
     1413 *
     1414 * @since 3.1.0
     1415 */
     1416function wp_ajax_time_format() {
     1417        _deprecated_function( __FUNCTION__, '4.8', 'wp-date.js' );
     1418
     1419        wp_die( date_i18n( sanitize_option( 'time_format', wp_unslash( $_POST['date'] ) ) ) );
     1420}
  • src/wp-admin/includes/options.php

     
    3232 * @since 3.5.0
    3333 */
    3434function options_general_add_js() {
     35        wp_enqueue_script( 'wp-date' );
    3536?>
    3637<script type="text/javascript">
    3738        jQuery(document).ready(function($){
     
    5051                });
    5152
    5253                $("input[name='date_format']").click(function(){
    53                         if ( "date_format_custom_radio" != $(this).attr("id") )
    54                                 $( "input[name='date_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
     54                        if ( "date_format_custom_radio" != $(this).attr("id") ) {
     55                                $( "input[name='date_format_custom']" ).val( $( this ).val() ).trigger( 'input' );
     56                        }
    5557                });
    5658                $("input[name='date_format_custom']").focus(function(){
    5759                        $( '#date_format_custom_radio' ).prop( 'checked', true );
     
    5860                });
    5961
    6062                $("input[name='time_format']").click(function(){
    61                         if ( "time_format_custom_radio" != $(this).attr("id") )
    62                                 $( "input[name='time_format_custom']" ).val( $( this ).val() ).siblings( '.example' ).text( $( this ).parent( 'label' ).children( '.format-i18n' ).text() );
     63                        if ( "time_format_custom_radio" != $(this).attr("id") ) {
     64                                $( "input[name='time_format_custom']" ).val( $( this ).val() ).trigger( 'input' );
     65                        }
    6366                });
    6467                $("input[name='time_format_custom']").focus(function(){
    6568                        $( '#time_format_custom_radio' ).prop( 'checked', true );
    6669                });
    67                 $("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {
     70                $("input[name='date_format_custom'], input[name='time_format_custom']").on( 'input', function() {
    6871                        var format = $(this);
    69                         format.siblings( '.spinner' ).addClass( 'is-active' );
    70                         $.post(ajaxurl, {
    71                                         action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',
    72                                         date : format.val()
    73                                 }, function(d) { format.siblings( '.spinner' ).removeClass( 'is-active' ); format.siblings('.example').text(d); } );
     72                        var formatted = wp.date.date_i18n( format.val() );
     73                        format.siblings( '.example' ).text( formatted );
    7474                });
    7575
    7676                var languageSelect = $( '#WPLANG' );
  • src/wp-includes/js/moment.js

     
     1//! moment.js
     2//! version : 2.17.1
     3//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
     4//! license : MIT
     5//! momentjs.com
     6!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return od.apply(null,arguments)}
     7// This is done to register the method called with moment()
     8// without creating circular dependencies.
     9function b(a){od=a}function c(a){return a instanceof Array||"[object Array]"===Object.prototype.toString.call(a)}function d(a){
     10// IE8 will treat undefined and null as object if it wasn't for
     11// input != null
     12return null!=a&&"[object Object]"===Object.prototype.toString.call(a)}function e(a){var b;for(b in a)
     13// even if its not own property I'd still call it non-empty
     14return!1;return!0}function f(a){return"number"==typeof a||"[object Number]"===Object.prototype.toString.call(a)}function g(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function h(a,b){var c,d=[];for(c=0;c<a.length;++c)d.push(b(a[c],c));return d}function i(a,b){return Object.prototype.hasOwnProperty.call(a,b)}function j(a,b){for(var c in b)i(b,c)&&(a[c]=b[c]);return i(b,"toString")&&(a.toString=b.toString),i(b,"valueOf")&&(a.valueOf=b.valueOf),a}function k(a,b,c,d){return rb(a,b,c,d,!0).utc()}function l(){
     15// We need to deep clone this object.
     16return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1,parsedDateParts:[],meridiem:null}}function m(a){return null==a._pf&&(a._pf=l()),a._pf}function n(a){if(null==a._isValid){var b=m(a),c=qd.call(b.parsedDateParts,function(a){return null!=a}),d=!isNaN(a._d.getTime())&&b.overflow<0&&!b.empty&&!b.invalidMonth&&!b.invalidWeekday&&!b.nullInput&&!b.invalidFormat&&!b.userInvalidated&&(!b.meridiem||b.meridiem&&c);if(a._strict&&(d=d&&0===b.charsLeftOver&&0===b.unusedTokens.length&&void 0===b.bigHour),null!=Object.isFrozen&&Object.isFrozen(a))return d;a._isValid=d}return a._isValid}function o(a){var b=k(NaN);return null!=a?j(m(b),a):m(b).userInvalidated=!0,b}function p(a){return void 0===a}function q(a,b){var c,d,e;if(p(b._isAMomentObject)||(a._isAMomentObject=b._isAMomentObject),p(b._i)||(a._i=b._i),p(b._f)||(a._f=b._f),p(b._l)||(a._l=b._l),p(b._strict)||(a._strict=b._strict),p(b._tzm)||(a._tzm=b._tzm),p(b._isUTC)||(a._isUTC=b._isUTC),p(b._offset)||(a._offset=b._offset),p(b._pf)||(a._pf=m(b)),p(b._locale)||(a._locale=b._locale),rd.length>0)for(c in rd)d=rd[c],e=b[d],p(e)||(a[d]=e);return a}
     17// Moment prototype object
     18function r(b){q(this,b),this._d=new Date(null!=b._d?b._d.getTime():NaN),this.isValid()||(this._d=new Date(NaN)),
     19// Prevent infinite loop in case updateOffset creates new moment
     20// objects.
     21sd===!1&&(sd=!0,a.updateOffset(this),sd=!1)}function s(a){return a instanceof r||null!=a&&null!=a._isAMomentObject}function t(a){return a<0?Math.ceil(a)||0:Math.floor(a)}function u(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=t(b)),c}
     22// compare two arrays, return the number of differences
     23function v(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;d<e;d++)(c&&a[d]!==b[d]||!c&&u(a[d])!==u(b[d]))&&g++;return g+f}function w(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function x(b,c){var d=!0;return j(function(){if(null!=a.deprecationHandler&&a.deprecationHandler(null,b),d){for(var e,f=[],g=0;g<arguments.length;g++){if(e="","object"==typeof arguments[g]){e+="\n["+g+"] ";for(var h in arguments[0])e+=h+": "+arguments[0][h]+", ";e=e.slice(0,-2)}else e=arguments[g];f.push(e)}w(b+"\nArguments: "+Array.prototype.slice.call(f).join("")+"\n"+(new Error).stack),d=!1}return c.apply(this,arguments)},c)}function y(b,c){null!=a.deprecationHandler&&a.deprecationHandler(b,c),td[b]||(w(c),td[b]=!0)}function z(a){return a instanceof Function||"[object Function]"===Object.prototype.toString.call(a)}function A(a){var b,c;for(c in a)b=a[c],z(b)?this[c]=b:this["_"+c]=b;this._config=a,
     24// Lenient ordinal parsing accepts just a number in addition to
     25// number + (possibly) stuff coming from _ordinalParseLenient.
     26this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function B(a,b){var c,e=j({},a);for(c in b)i(b,c)&&(d(a[c])&&d(b[c])?(e[c]={},j(e[c],a[c]),j(e[c],b[c])):null!=b[c]?e[c]=b[c]:delete e[c]);for(c in a)i(a,c)&&!i(b,c)&&d(a[c])&&(
     27// make sure changes to properties don't modify parent config
     28e[c]=j({},e[c]));return e}function C(a){null!=a&&this.set(a)}function D(a,b,c){var d=this._calendar[a]||this._calendar.sameElse;return z(d)?d.call(b,c):d}function E(a){var b=this._longDateFormat[a],c=this._longDateFormat[a.toUpperCase()];return b||!c?b:(this._longDateFormat[a]=c.replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a])}function F(){return this._invalidDate}function G(a){return this._ordinal.replace("%d",a)}function H(a,b,c,d){var e=this._relativeTime[c];return z(e)?e(a,b,c,d):e.replace(/%d/i,a)}function I(a,b){var c=this._relativeTime[a>0?"future":"past"];return z(c)?c(b):c.replace(/%s/i,b)}function J(a,b){var c=a.toLowerCase();Dd[c]=Dd[c+"s"]=Dd[b]=a}function K(a){return"string"==typeof a?Dd[a]||Dd[a.toLowerCase()]:void 0}function L(a){var b,c,d={};for(c in a)i(a,c)&&(b=K(c),b&&(d[b]=a[c]));return d}function M(a,b){Ed[a]=b}function N(a){var b=[];for(var c in a)b.push({unit:c,priority:Ed[c]});return b.sort(function(a,b){return a.priority-b.priority}),b}function O(b,c){return function(d){return null!=d?(Q(this,b,d),a.updateOffset(this,c),this):P(this,b)}}function P(a,b){return a.isValid()?a._d["get"+(a._isUTC?"UTC":"")+b]():NaN}function Q(a,b,c){a.isValid()&&a._d["set"+(a._isUTC?"UTC":"")+b](c)}
     29// MOMENTS
     30function R(a){return a=K(a),z(this[a])?this[a]():this}function S(a,b){if("object"==typeof a){a=L(a);for(var c=N(a),d=0;d<c.length;d++)this[c[d].unit](a[c[d].unit])}else if(a=K(a),z(this[a]))return this[a](b);return this}function T(a,b,c){var d=""+Math.abs(a),e=b-d.length,f=a>=0;return(f?c?"+":"":"-")+Math.pow(10,Math.max(0,e)).toString().substr(1)+d}
     31// token:    'M'
     32// padded:   ['MM', 2]
     33// ordinal:  'Mo'
     34// callback: function () { this.month() + 1 }
     35function U(a,b,c,d){var e=d;"string"==typeof d&&(e=function(){return this[d]()}),a&&(Id[a]=e),b&&(Id[b[0]]=function(){return T(e.apply(this,arguments),b[1],b[2])}),c&&(Id[c]=function(){return this.localeData().ordinal(e.apply(this,arguments),a)})}function V(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function W(a){var b,c,d=a.match(Fd);for(b=0,c=d.length;b<c;b++)Id[d[b]]?d[b]=Id[d[b]]:d[b]=V(d[b]);return function(b){var e,f="";for(e=0;e<c;e++)f+=d[e]instanceof Function?d[e].call(b,a):d[e];return f}}
     36// format date using native date object
     37function X(a,b){return a.isValid()?(b=Y(b,a.localeData()),Hd[b]=Hd[b]||W(b),Hd[b](a)):a.localeData().invalidDate()}function Y(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Gd.lastIndex=0;d>=0&&Gd.test(a);)a=a.replace(Gd,c),Gd.lastIndex=0,d-=1;return a}function Z(a,b,c){$d[a]=z(b)?b:function(a,d){return a&&c?c:b}}function $(a,b){return i($d,a)?$d[a](b._strict,b._locale):new RegExp(_(a))}
     38// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
     39function _(a){return aa(a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}))}function aa(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function ba(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),f(b)&&(d=function(a,c){c[b]=u(a)}),c=0;c<a.length;c++)_d[a[c]]=d}function ca(a,b){ba(a,function(a,c,d,e){d._w=d._w||{},b(a,d._w,d,e)})}function da(a,b,c){null!=b&&i(_d,a)&&_d[a](b,c._a,c,a)}function ea(a,b){return new Date(Date.UTC(a,b+1,0)).getUTCDate()}function fa(a,b){return a?c(this._months)?this._months[a.month()]:this._months[(this._months.isFormat||ke).test(b)?"format":"standalone"][a.month()]:this._months}function ga(a,b){return a?c(this._monthsShort)?this._monthsShort[a.month()]:this._monthsShort[ke.test(b)?"format":"standalone"][a.month()]:this._monthsShort}function ha(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._monthsParse)for(
     40// this is not used
     41this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[],d=0;d<12;++d)f=k([2e3,d]),this._shortMonthsParse[d]=this.monthsShort(f,"").toLocaleLowerCase(),this._longMonthsParse[d]=this.months(f,"").toLocaleLowerCase();return c?"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:null):(e=je.call(this._longMonthsParse,g),e!==-1?e:null):"MMM"===b?(e=je.call(this._shortMonthsParse,g),e!==-1?e:(e=je.call(this._longMonthsParse,g),e!==-1?e:null)):(e=je.call(this._longMonthsParse,g),e!==-1?e:(e=je.call(this._shortMonthsParse,g),e!==-1?e:null))}function ia(a,b,c){var d,e,f;if(this._monthsParseExact)return ha.call(this,a,b,c);
     42// TODO: add sorting
     43// Sorting makes sure if one month (or abbr) is a prefix of another
     44// see sorting in computeMonthsParse
     45for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),d=0;d<12;d++){
     46// test the regex
     47if(
     48// make the regex if we don't have it already
     49e=k([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}
     50// MOMENTS
     51function ja(a,b){var c;if(!a.isValid())
     52// No op
     53return a;if("string"==typeof b)if(/^\d+$/.test(b))b=u(b);else
     54// TODO: Another silent failure?
     55if(b=a.localeData().monthsParse(b),!f(b))return a;return c=Math.min(a.date(),ea(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a}function ka(b){return null!=b?(ja(this,b),a.updateOffset(this,!0),this):P(this,"Month")}function la(){return ea(this.year(),this.month())}function ma(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsShortStrictRegex:this._monthsShortRegex):(i(this,"_monthsShortRegex")||(this._monthsShortRegex=ne),this._monthsShortStrictRegex&&a?this._monthsShortStrictRegex:this._monthsShortRegex)}function na(a){return this._monthsParseExact?(i(this,"_monthsRegex")||oa.call(this),a?this._monthsStrictRegex:this._monthsRegex):(i(this,"_monthsRegex")||(this._monthsRegex=oe),this._monthsStrictRegex&&a?this._monthsStrictRegex:this._monthsRegex)}function oa(){function a(a,b){return b.length-a.length}var b,c,d=[],e=[],f=[];for(b=0;b<12;b++)
     56// make the regex if we don't have it already
     57c=k([2e3,b]),d.push(this.monthsShort(c,"")),e.push(this.months(c,"")),f.push(this.months(c,"")),f.push(this.monthsShort(c,""));for(
     58// Sorting makes sure if one month (or abbr) is a prefix of another it
     59// will match the longer piece.
     60d.sort(a),e.sort(a),f.sort(a),b=0;b<12;b++)d[b]=aa(d[b]),e[b]=aa(e[b]);for(b=0;b<24;b++)f[b]=aa(f[b]);this._monthsRegex=new RegExp("^("+f.join("|")+")","i"),this._monthsShortRegex=this._monthsRegex,this._monthsStrictRegex=new RegExp("^("+e.join("|")+")","i"),this._monthsShortStrictRegex=new RegExp("^("+d.join("|")+")","i")}
     61// HELPERS
     62function pa(a){return qa(a)?366:365}function qa(a){return a%4===0&&a%100!==0||a%400===0}function ra(){return qa(this.year())}function sa(a,b,c,d,e,f,g){
     63//can't just apply() to create a date:
     64//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
     65var h=new Date(a,b,c,d,e,f,g);
     66//the date constructor remaps years 0-99 to 1900-1999
     67return a<100&&a>=0&&isFinite(h.getFullYear())&&h.setFullYear(a),h}function ta(a){var b=new Date(Date.UTC.apply(null,arguments));
     68//the Date.UTC function remaps years 0-99 to 1900-1999
     69return a<100&&a>=0&&isFinite(b.getUTCFullYear())&&b.setUTCFullYear(a),b}
     70// start-of-first-week - start-of-year
     71function ua(a,b,c){var// first-week day -- which january is always in the first week (4 for iso, 1 for other)
     72d=7+b-c,
     73// first-week day local weekday -- which local weekday is fwd
     74e=(7+ta(a,0,d).getUTCDay()-b)%7;return-e+d-1}
     75//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
     76function va(a,b,c,d,e){var f,g,h=(7+c-d)%7,i=ua(a,d,e),j=1+7*(b-1)+h+i;return j<=0?(f=a-1,g=pa(f)+j):j>pa(a)?(f=a+1,g=j-pa(a)):(f=a,g=j),{year:f,dayOfYear:g}}function wa(a,b,c){var d,e,f=ua(a.year(),b,c),g=Math.floor((a.dayOfYear()-f-1)/7)+1;return g<1?(e=a.year()-1,d=g+xa(e,b,c)):g>xa(a.year(),b,c)?(d=g-xa(a.year(),b,c),e=a.year()+1):(e=a.year(),d=g),{week:d,year:e}}function xa(a,b,c){var d=ua(a,b,c),e=ua(a+1,b,c);return(pa(a)-d+e)/7}
     77// HELPERS
     78// LOCALES
     79function ya(a){return wa(a,this._week.dow,this._week.doy).week}function za(){return this._week.dow}function Aa(){return this._week.doy}
     80// MOMENTS
     81function Ba(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function Ca(a){var b=wa(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}
     82// HELPERS
     83function Da(a,b){return"string"!=typeof a?a:isNaN(a)?(a=b.weekdaysParse(a),"number"==typeof a?a:null):parseInt(a,10)}function Ea(a,b){return"string"==typeof a?b.weekdaysParse(a)%7||7:isNaN(a)?null:a}function Fa(a,b){return a?c(this._weekdays)?this._weekdays[a.day()]:this._weekdays[this._weekdays.isFormat.test(b)?"format":"standalone"][a.day()]:this._weekdays}function Ga(a){return a?this._weekdaysShort[a.day()]:this._weekdaysShort}function Ha(a){return a?this._weekdaysMin[a.day()]:this._weekdaysMin}function Ia(a,b,c){var d,e,f,g=a.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],d=0;d<7;++d)f=k([2e3,1]).day(d),this._minWeekdaysParse[d]=this.weekdaysMin(f,"").toLocaleLowerCase(),this._shortWeekdaysParse[d]=this.weekdaysShort(f,"").toLocaleLowerCase(),this._weekdaysParse[d]=this.weekdays(f,"").toLocaleLowerCase();return c?"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:null):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null):"dddd"===b?(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):"ddd"===b?(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._minWeekdaysParse,g),e!==-1?e:null))):(e=je.call(this._minWeekdaysParse,g),e!==-1?e:(e=je.call(this._weekdaysParse,g),e!==-1?e:(e=je.call(this._shortWeekdaysParse,g),e!==-1?e:null)))}function Ja(a,b,c){var d,e,f;if(this._weekdaysParseExact)return Ia.call(this,a,b,c);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),d=0;d<7;d++){
     84// test the regex
     85if(
     86// make the regex if we don't have it already
     87e=k([2e3,1]).day(d),c&&!this._fullWeekdaysParse[d]&&(this._fullWeekdaysParse[d]=new RegExp("^"+this.weekdays(e,"").replace(".",".?")+"$","i"),this._shortWeekdaysParse[d]=new RegExp("^"+this.weekdaysShort(e,"").replace(".",".?")+"$","i"),this._minWeekdaysParse[d]=new RegExp("^"+this.weekdaysMin(e,"").replace(".",".?")+"$","i")),this._weekdaysParse[d]||(f="^"+this.weekdays(e,"")+"|^"+this.weekdaysShort(e,"")+"|^"+this.weekdaysMin(e,""),this._weekdaysParse[d]=new RegExp(f.replace(".",""),"i")),c&&"dddd"===b&&this._fullWeekdaysParse[d].test(a))return d;if(c&&"ddd"===b&&this._shortWeekdaysParse[d].test(a))return d;if(c&&"dd"===b&&this._minWeekdaysParse[d].test(a))return d;if(!c&&this._weekdaysParse[d].test(a))return d}}
     88// MOMENTS
     89function Ka(a){if(!this.isValid())return null!=a?this:NaN;var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Da(a,this.localeData()),this.add(a-b,"d")):b}function La(a){if(!this.isValid())return null!=a?this:NaN;var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ma(a){if(!this.isValid())return null!=a?this:NaN;
     90// behaves the same as moment#day except
     91// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
     92// as a setter, sunday should belong to the previous week.
     93if(null!=a){var b=Ea(a,this.localeData());return this.day(this.day()%7?b:b-7)}return this.day()||7}function Na(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysStrictRegex:this._weekdaysRegex):(i(this,"_weekdaysRegex")||(this._weekdaysRegex=ue),this._weekdaysStrictRegex&&a?this._weekdaysStrictRegex:this._weekdaysRegex)}function Oa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(i(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=ve),this._weekdaysShortStrictRegex&&a?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)}function Pa(a){return this._weekdaysParseExact?(i(this,"_weekdaysRegex")||Qa.call(this),a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(i(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=we),this._weekdaysMinStrictRegex&&a?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)}function Qa(){function a(a,b){return b.length-a.length}var b,c,d,e,f,g=[],h=[],i=[],j=[];for(b=0;b<7;b++)
     94// make the regex if we don't have it already
     95c=k([2e3,1]).day(b),d=this.weekdaysMin(c,""),e=this.weekdaysShort(c,""),f=this.weekdays(c,""),g.push(d),h.push(e),i.push(f),j.push(d),j.push(e),j.push(f);for(
     96// Sorting makes sure if one weekday (or abbr) is a prefix of another it
     97// will match the longer piece.
     98g.sort(a),h.sort(a),i.sort(a),j.sort(a),b=0;b<7;b++)h[b]=aa(h[b]),i[b]=aa(i[b]),j[b]=aa(j[b]);this._weekdaysRegex=new RegExp("^("+j.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+i.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+h.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+g.join("|")+")","i")}
     99// FORMATTING
     100function Ra(){return this.hours()%12||12}function Sa(){return this.hours()||24}function Ta(a,b){U(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}
     101// PARSING
     102function Ua(a,b){return b._meridiemParse}
     103// LOCALES
     104function Va(a){
     105// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
     106// Using charAt should be more compatible.
     107return"p"===(a+"").toLowerCase().charAt(0)}function Wa(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Xa(a){return a?a.toLowerCase().replace("_","-"):a}
     108// pick the locale from the array
     109// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
     110// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
     111function Ya(a){for(var b,c,d,e,f=0;f<a.length;){for(e=Xa(a[f]).split("-"),b=e.length,c=Xa(a[f+1]),c=c?c.split("-"):null;b>0;){if(d=Za(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&v(e,c,!0)>=b-1)
     112//the next array item is better than a shallower substring of this one
     113break;b--}f++}return null}function Za(a){var b=null;
     114// TODO: Find a better way to register and load all the locales in Node
     115if(!Be[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=xe._abbr,require("./locale/"+a),
     116// because defineLocale currently also sets the global locale, we
     117// want to undo that for lazy loaded locales
     118$a(b)}catch(a){}return Be[a]}
     119// This function will load locale and then set the global locale.  If
     120// no arguments are passed in, it will simply return the current global
     121// locale key.
     122function $a(a,b){var c;
     123// moment.duration._locale = moment._locale = data;
     124return a&&(c=p(b)?bb(a):_a(a,b),c&&(xe=c)),xe._abbr}function _a(a,b){if(null!==b){var c=Ae;if(b.abbr=a,null!=Be[a])y("defineLocaleOverride","use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."),c=Be[a]._config;else if(null!=b.parentLocale){if(null==Be[b.parentLocale])return Ce[b.parentLocale]||(Ce[b.parentLocale]=[]),Ce[b.parentLocale].push({name:a,config:b}),null;c=Be[b.parentLocale]._config}
     125// backwards compat for now: also set the locale
     126// make sure we set the locale AFTER all child locales have been
     127// created, so we won't end up with the child locale set.
     128return Be[a]=new C(B(c,b)),Ce[a]&&Ce[a].forEach(function(a){_a(a.name,a.config)}),$a(a),Be[a]}
     129// useful for testing
     130return delete Be[a],null}function ab(a,b){if(null!=b){var c,d=Ae;
     131// MERGE
     132null!=Be[a]&&(d=Be[a]._config),b=B(d,b),c=new C(b),c.parentLocale=Be[a],Be[a]=c,
     133// backwards compat for now: also set the locale
     134$a(a)}else
     135// pass null for config to unupdate, useful for tests
     136null!=Be[a]&&(null!=Be[a].parentLocale?Be[a]=Be[a].parentLocale:null!=Be[a]&&delete Be[a]);return Be[a]}
     137// returns locale data
     138function bb(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return xe;if(!c(a)){if(
     139//short-circuit everything else
     140b=Za(a))return b;a=[a]}return Ya(a)}function cb(){return wd(Be)}function db(a){var b,c=a._a;return c&&m(a).overflow===-2&&(b=c[be]<0||c[be]>11?be:c[ce]<1||c[ce]>ea(c[ae],c[be])?ce:c[de]<0||c[de]>24||24===c[de]&&(0!==c[ee]||0!==c[fe]||0!==c[ge])?de:c[ee]<0||c[ee]>59?ee:c[fe]<0||c[fe]>59?fe:c[ge]<0||c[ge]>999?ge:-1,m(a)._overflowDayOfYear&&(b<ae||b>ce)&&(b=ce),m(a)._overflowWeeks&&b===-1&&(b=he),m(a)._overflowWeekday&&b===-1&&(b=ie),m(a).overflow=b),a}
     141// date from iso format
     142function eb(a){var b,c,d,e,f,g,h=a._i,i=De.exec(h)||Ee.exec(h);if(i){for(m(a).iso=!0,b=0,c=Ge.length;b<c;b++)if(Ge[b][1].exec(i[1])){e=Ge[b][0],d=Ge[b][2]!==!1;break}if(null==e)return void(a._isValid=!1);if(i[3]){for(b=0,c=He.length;b<c;b++)if(He[b][1].exec(i[3])){
     143// match[2] should be 'T' or space
     144f=(i[2]||" ")+He[b][0];break}if(null==f)return void(a._isValid=!1)}if(!d&&null!=f)return void(a._isValid=!1);if(i[4]){if(!Fe.exec(i[4]))return void(a._isValid=!1);g="Z"}a._f=e+(f||"")+(g||""),kb(a)}else a._isValid=!1}
     145// date from iso format or fallback
     146function fb(b){var c=Ie.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(eb(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}
     147// Pick the first defined of two or three arguments.
     148function gb(a,b,c){return null!=a?a:null!=b?b:c}function hb(b){
     149// hooks is actually the exported moment object
     150var c=new Date(a.now());return b._useUTC?[c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()]:[c.getFullYear(),c.getMonth(),c.getDate()]}
     151// convert an array to a date.
     152// the array should mirror the parameters below
     153// note: all values past the year are optional and will default to the lowest possible value.
     154// [year, month, day , hour, minute, second, millisecond]
     155function ib(a){var b,c,d,e,f=[];if(!a._d){
     156// Default to current date.
     157// * if no year, month, day of month are given, default to today
     158// * if day of month is given, default month and year
     159// * if month is given, default only year
     160// * if year is given, don't default anything
     161for(d=hb(a),
     162//compute day of the year from weeks and weekdays
     163a._w&&null==a._a[ce]&&null==a._a[be]&&jb(a),
     164//if the day of the year is set, figure out what it is
     165a._dayOfYear&&(e=gb(a._a[ae],d[ae]),a._dayOfYear>pa(e)&&(m(a)._overflowDayOfYear=!0),c=ta(e,0,a._dayOfYear),a._a[be]=c.getUTCMonth(),a._a[ce]=c.getUTCDate()),b=0;b<3&&null==a._a[b];++b)a._a[b]=f[b]=d[b];
     166// Zero out whatever was not defaulted, including time
     167for(;b<7;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];
     168// Check for 24:00:00.000
     16924===a._a[de]&&0===a._a[ee]&&0===a._a[fe]&&0===a._a[ge]&&(a._nextDay=!0,a._a[de]=0),a._d=(a._useUTC?ta:sa).apply(null,f),
     170// Apply timezone offset from input. The actual utcOffset can be changed
     171// with parseZone.
     172null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[de]=24)}}function jb(a){var b,c,d,e,f,g,h,i;if(b=a._w,null!=b.GG||null!=b.W||null!=b.E)f=1,g=4,
     173// TODO: We need to take the current isoWeekYear, but that depends on
     174// how we interpret now (local, utc, fixed offset). So create
     175// a now version of current config (take local/utc/offset flags, and
     176// create now).
     177c=gb(b.GG,a._a[ae],wa(sb(),1,4).year),d=gb(b.W,1),e=gb(b.E,1),(e<1||e>7)&&(i=!0);else{f=a._locale._week.dow,g=a._locale._week.doy;var j=wa(sb(),f,g);c=gb(b.gg,a._a[ae],j.year),
     178// Default to current week.
     179d=gb(b.w,j.week),null!=b.d?(
     180// weekday -- low day numbers are considered next week
     181e=b.d,(e<0||e>6)&&(i=!0)):null!=b.e?(
     182// local weekday -- counting starts from begining of week
     183e=b.e+f,(b.e<0||b.e>6)&&(i=!0)):
     184// default to begining of week
     185e=f}d<1||d>xa(c,f,g)?m(a)._overflowWeeks=!0:null!=i?m(a)._overflowWeekday=!0:(h=va(c,d,e,f,g),a._a[ae]=h.year,a._dayOfYear=h.dayOfYear)}
     186// date from string and format string
     187function kb(b){
     188// TODO: Move this to another part of the creation flow to prevent circular deps
     189if(b._f===a.ISO_8601)return void eb(b);b._a=[],m(b).empty=!0;
     190// This array is used to make a Date, either with `new Date` or `Date.UTC`
     191var c,d,e,f,g,h=""+b._i,i=h.length,j=0;for(e=Y(b._f,b._locale).match(Fd)||[],c=0;c<e.length;c++)f=e[c],d=(h.match($(f,b))||[])[0],
     192// console.log('token', token, 'parsedInput', parsedInput,
     193//         'regex', getParseRegexForToken(token, config));
     194d&&(g=h.substr(0,h.indexOf(d)),g.length>0&&m(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),j+=d.length),
     195// don't parse if it's not a known token
     196Id[f]?(d?m(b).empty=!1:m(b).unusedTokens.push(f),da(f,d,b)):b._strict&&!d&&m(b).unusedTokens.push(f);
     197// add remaining unparsed input length to the string
     198m(b).charsLeftOver=i-j,h.length>0&&m(b).unusedInput.push(h),
     199// clear _12h flag if hour is <= 12
     200b._a[de]<=12&&m(b).bigHour===!0&&b._a[de]>0&&(m(b).bigHour=void 0),m(b).parsedDateParts=b._a.slice(0),m(b).meridiem=b._meridiem,
     201// handle meridiem
     202b._a[de]=lb(b._locale,b._a[de],b._meridiem),ib(b),db(b)}function lb(a,b,c){var d;
     203// Fallback
     204return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&b<12&&(b+=12),d||12!==b||(b=0),b):b}
     205// date from string and array of format strings
     206function mb(a){var b,c,d,e,f;if(0===a._f.length)return m(a).invalidFormat=!0,void(a._d=new Date(NaN));for(e=0;e<a._f.length;e++)f=0,b=q({},a),null!=a._useUTC&&(b._useUTC=a._useUTC),b._f=a._f[e],kb(b),n(b)&&(
     207// if there is any input that was not parsed add a penalty for that format
     208f+=m(b).charsLeftOver,
     209//or tokens
     210f+=10*m(b).unusedTokens.length,m(b).score=f,(null==d||f<d)&&(d=f,c=b));j(a,c||b)}function nb(a){if(!a._d){var b=L(a._i);a._a=h([b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],function(a){return a&&parseInt(a,10)}),ib(a)}}function ob(a){var b=new r(db(pb(a)));
     211// Adding is smart enough around DST
     212return b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b}function pb(a){var b=a._i,d=a._f;return a._locale=a._locale||bb(a._l),null===b||void 0===d&&""===b?o({nullInput:!0}):("string"==typeof b&&(a._i=b=a._locale.preparse(b)),s(b)?new r(db(b)):(g(b)?a._d=b:c(d)?mb(a):d?kb(a):qb(a),n(a)||(a._d=null),a))}function qb(b){var d=b._i;void 0===d?b._d=new Date(a.now()):g(d)?b._d=new Date(d.valueOf()):"string"==typeof d?fb(b):c(d)?(b._a=h(d.slice(0),function(a){return parseInt(a,10)}),ib(b)):"object"==typeof d?nb(b):f(d)?
     213// from milliseconds
     214b._d=new Date(d):a.createFromInputFallback(b)}function rb(a,b,f,g,h){var i={};
     215// object construction must be done this way.
     216// https://github.com/moment/moment/issues/1423
     217return f!==!0&&f!==!1||(g=f,f=void 0),(d(a)&&e(a)||c(a)&&0===a.length)&&(a=void 0),i._isAMomentObject=!0,i._useUTC=i._isUTC=h,i._l=f,i._i=a,i._f=b,i._strict=g,ob(i)}function sb(a,b,c,d){return rb(a,b,c,d,!1)}
     218// Pick a moment m from moments so that m[fn](other) is true for all
     219// other. This relies on the function fn to be transitive.
     220//
     221// moments should either be an array of moment objects or an array, whose
     222// first element is an array of moment objects.
     223function tb(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return sb();for(d=b[0],e=1;e<b.length;++e)b[e].isValid()&&!b[e][a](d)||(d=b[e]);return d}
     224// TODO: Use [].sort instead?
     225function ub(){var a=[].slice.call(arguments,0);return tb("isBefore",a)}function vb(){var a=[].slice.call(arguments,0);return tb("isAfter",a)}function wb(a){var b=L(a),c=b.year||0,d=b.quarter||0,e=b.month||0,f=b.week||0,g=b.day||0,h=b.hour||0,i=b.minute||0,j=b.second||0,k=b.millisecond||0;
     226// representation for dateAddRemove
     227this._milliseconds=+k+1e3*j+// 1000
     2286e4*i+// 1000 * 60
     2291e3*h*60*60,//using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
     230// Because of dateAddRemove treats 24 hours as different from a
     231// day when working around DST, we need to store them separately
     232this._days=+g+7*f,
     233// It is impossible translate months into days without knowing
     234// which months you are are talking about, so we have to store
     235// it separately.
     236this._months=+e+3*d+12*c,this._data={},this._locale=bb(),this._bubble()}function xb(a){return a instanceof wb}function yb(a){return a<0?Math.round(-1*a)*-1:Math.round(a)}
     237// FORMATTING
     238function zb(a,b){U(a,0,0,function(){var a=this.utcOffset(),c="+";return a<0&&(a=-a,c="-"),c+T(~~(a/60),2)+b+T(~~a%60,2)})}function Ab(a,b){var c=(b||"").match(a);if(null===c)return null;var d=c[c.length-1]||[],e=(d+"").match(Me)||["-",0,0],f=+(60*e[1])+u(e[2]);return 0===f?0:"+"===e[0]?f:-f}
     239// Return a moment from input, that is local/utc/zone equivalent to model.
     240function Bb(b,c){var d,e;
     241// Use low-level api, because this fn is low-level api.
     242return c._isUTC?(d=c.clone(),e=(s(b)||g(b)?b.valueOf():sb(b).valueOf())-d.valueOf(),d._d.setTime(d._d.valueOf()+e),a.updateOffset(d,!1),d):sb(b).local()}function Cb(a){
     243// On Firefox.24 Date#getTimezoneOffset returns a floating point.
     244// https://github.com/moment/moment/pull/1871
     245return 15*-Math.round(a._d.getTimezoneOffset()/15)}
     246// MOMENTS
     247// keepLocalTime = true means only change the timezone, without
     248// affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
     249// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
     250// +0200, so we adjust the time as needed, to be valid.
     251//
     252// Keeping the time actually adds/subtracts (one hour)
     253// from the actual represented time. That is why we call updateOffset
     254// a second time. In case it wants us to change the offset again
     255// _changeInProgress == true case, then we have to adjust, because
     256// there is no such time in the given timezone.
     257function Db(b,c){var d,e=this._offset||0;if(!this.isValid())return null!=b?this:NaN;if(null!=b){if("string"==typeof b){if(b=Ab(Xd,b),null===b)return this}else Math.abs(b)<16&&(b=60*b);return!this._isUTC&&c&&(d=Cb(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?Tb(this,Ob(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this}return this._isUTC?e:Cb(this)}function Eb(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Fb(a){return this.utcOffset(0,a)}function Gb(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Cb(this),"m")),this}function Hb(){if(null!=this._tzm)this.utcOffset(this._tzm);else if("string"==typeof this._i){var a=Ab(Wd,this._i);null!=a?this.utcOffset(a):this.utcOffset(0,!0)}return this}function Ib(a){return!!this.isValid()&&(a=a?sb(a).utcOffset():0,(this.utcOffset()-a)%60===0)}function Jb(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Kb(){if(!p(this._isDSTShifted))return this._isDSTShifted;var a={};if(q(a,this),a=pb(a),a._a){var b=a._isUTC?k(a._a):sb(a._a);this._isDSTShifted=this.isValid()&&v(a._a,b.toArray())>0}else this._isDSTShifted=!1;return this._isDSTShifted}function Lb(){return!!this.isValid()&&!this._isUTC}function Mb(){return!!this.isValid()&&this._isUTC}function Nb(){return!!this.isValid()&&(this._isUTC&&0===this._offset)}function Ob(a,b){var c,d,e,g=a,
     258// matching against regexp is expensive, do it on demand
     259h=null;// checks for null or undefined
     260return xb(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:f(a)?(g={},b?g[b]=a:g.milliseconds=a):(h=Ne.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:u(h[ce])*c,h:u(h[de])*c,m:u(h[ee])*c,s:u(h[fe])*c,ms:u(yb(1e3*h[ge]))*c}):(h=Oe.exec(a))?(c="-"===h[1]?-1:1,g={y:Pb(h[2],c),M:Pb(h[3],c),w:Pb(h[4],c),d:Pb(h[5],c),h:Pb(h[6],c),m:Pb(h[7],c),s:Pb(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Rb(sb(g.from),sb(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new wb(g),xb(a)&&i(a,"_locale")&&(d._locale=a._locale),d}function Pb(a,b){
     261// We'd normally use ~~inp for this, but unfortunately it also
     262// converts floats to ints.
     263// inp may be undefined, so careful calling replace on it.
     264var c=a&&parseFloat(a.replace(",","."));
     265// apply sign while we're at it
     266return(isNaN(c)?0:c)*b}function Qb(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Rb(a,b){var c;return a.isValid()&&b.isValid()?(b=Bb(b,a),a.isBefore(b)?c=Qb(a,b):(c=Qb(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c):{milliseconds:0,months:0}}
     267// TODO: remove 'name' arg after deprecation is removed
     268function Sb(a,b){return function(c,d){var e,f;
     269//invert the arguments, but complain about it
     270return null===d||isNaN(+d)||(y(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Ob(c,d),Tb(this,e,a),this}}function Tb(b,c,d,e){var f=c._milliseconds,g=yb(c._days),h=yb(c._months);b.isValid()&&(e=null==e||e,f&&b._d.setTime(b._d.valueOf()+f*d),g&&Q(b,"Date",P(b,"Date")+g*d),h&&ja(b,P(b,"Month")+h*d),e&&a.updateOffset(b,g||h))}function Ub(a,b){var c=a.diff(b,"days",!0);return c<-6?"sameElse":c<-1?"lastWeek":c<0?"lastDay":c<1?"sameDay":c<2?"nextDay":c<7?"nextWeek":"sameElse"}function Vb(b,c){
     271// We want to compare the start of today, vs this.
     272// Getting start-of-today depends on whether we're local/utc/offset or not.
     273var d=b||sb(),e=Bb(d,this).startOf("day"),f=a.calendarFormat(this,e)||"sameElse",g=c&&(z(c[f])?c[f].call(this,d):c[f]);return this.format(g||this.localeData().calendar(f,this,sb(d)))}function Wb(){return new r(this)}function Xb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()>c.valueOf():c.valueOf()<this.clone().startOf(b).valueOf())}function Yb(a,b){var c=s(a)?a:sb(a);return!(!this.isValid()||!c.isValid())&&(b=K(p(b)?"millisecond":b),"millisecond"===b?this.valueOf()<c.valueOf():this.clone().endOf(b).valueOf()<c.valueOf())}function Zb(a,b,c,d){return d=d||"()",("("===d[0]?this.isAfter(a,c):!this.isBefore(a,c))&&(")"===d[1]?this.isBefore(b,c):!this.isAfter(b,c))}function $b(a,b){var c,d=s(a)?a:sb(a);return!(!this.isValid()||!d.isValid())&&(b=K(b||"millisecond"),"millisecond"===b?this.valueOf()===d.valueOf():(c=d.valueOf(),this.clone().startOf(b).valueOf()<=c&&c<=this.clone().endOf(b).valueOf()))}function _b(a,b){return this.isSame(a,b)||this.isAfter(a,b)}function ac(a,b){return this.isSame(a,b)||this.isBefore(a,b)}function bc(a,b,c){var d,e,f,g;// 1000
     274// 1000 * 60
     275// 1000 * 60 * 60
     276// 1000 * 60 * 60 * 24, negate dst
     277// 1000 * 60 * 60 * 24 * 7, negate dst
     278return this.isValid()?(d=Bb(a,this),d.isValid()?(e=6e4*(d.utcOffset()-this.utcOffset()),b=K(b),"year"===b||"month"===b||"quarter"===b?(g=cc(this,d),"quarter"===b?g/=3:"year"===b&&(g/=12)):(f=this-d,g="second"===b?f/1e3:"minute"===b?f/6e4:"hour"===b?f/36e5:"day"===b?(f-e)/864e5:"week"===b?(f-e)/6048e5:f),c?g:t(g)):NaN):NaN}function cc(a,b){
     279// difference in months
     280var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),
     281// b is in (anchor - 1 month, anchor + 1 month)
     282f=a.clone().add(e,"months");
     283//check for negative zero, return zero if negative zero
     284// linear across the month
     285// linear across the month
     286return b-f<0?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)||0}function dc(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function ec(){var a=this.clone().utc();return 0<a.year()&&a.year()<=9999?z(Date.prototype.toISOString)?this.toDate().toISOString():X(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):X(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}/**
     287 * Return a human readable representation of a moment that can
     288 * also be evaluated to get a new moment which is the same
     289 *
     290 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
     291 */
     292function fc(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var a="moment",b="";this.isLocal()||(a=0===this.utcOffset()?"moment.utc":"moment.parseZone",b="Z");var c="["+a+'("]',d=0<this.year()&&this.year()<=9999?"YYYY":"YYYYYY",e="-MM-DD[T]HH:mm:ss.SSS",f=b+'[")]';return this.format(c+d+e+f)}function gc(b){b||(b=this.isUtc()?a.defaultFormatUtc:a.defaultFormat);var c=X(this,b);return this.localeData().postformat(c)}function hc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({to:this,from:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function ic(a){return this.from(sb(),a)}function jc(a,b){return this.isValid()&&(s(a)&&a.isValid()||sb(a).isValid())?Ob({from:this,to:a}).locale(this.locale()).humanize(!b):this.localeData().invalidDate()}function kc(a){return this.to(sb(),a)}
     293// If passed a locale key, it will set the locale for this
     294// instance.  Otherwise, it will return the locale configuration
     295// variables for this instance.
     296function lc(a){var b;return void 0===a?this._locale._abbr:(b=bb(a),null!=b&&(this._locale=b),this)}function mc(){return this._locale}function nc(a){
     297// the following switch intentionally omits break keywords
     298// to utilize falling through the cases.
     299switch(a=K(a)){case"year":this.month(0);/* falls through */
     300case"quarter":case"month":this.date(1);/* falls through */
     301case"week":case"isoWeek":case"day":case"date":this.hours(0);/* falls through */
     302case"hour":this.minutes(0);/* falls through */
     303case"minute":this.seconds(0);/* falls through */
     304case"second":this.milliseconds(0)}
     305// weeks are a special case
     306// quarters are also special
     307return"week"===a&&this.weekday(0),"isoWeek"===a&&this.isoWeekday(1),"quarter"===a&&this.month(3*Math.floor(this.month()/3)),this}function oc(a){
     308// 'date' is an alias for 'day', so it should be considered as such.
     309return a=K(a),void 0===a||"millisecond"===a?this:("date"===a&&(a="day"),this.startOf(a).add(1,"isoWeek"===a?"week":a).subtract(1,"ms"))}function pc(){return this._d.valueOf()-6e4*(this._offset||0)}function qc(){return Math.floor(this.valueOf()/1e3)}function rc(){return new Date(this.valueOf())}function sc(){var a=this;return[a.year(),a.month(),a.date(),a.hour(),a.minute(),a.second(),a.millisecond()]}function tc(){var a=this;return{years:a.year(),months:a.month(),date:a.date(),hours:a.hours(),minutes:a.minutes(),seconds:a.seconds(),milliseconds:a.milliseconds()}}function uc(){
     310// new Date(NaN).toJSON() === null
     311return this.isValid()?this.toISOString():null}function vc(){return n(this)}function wc(){return j({},m(this))}function xc(){return m(this).overflow}function yc(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}}function zc(a,b){U(0,[a,a.length],0,b)}
     312// MOMENTS
     313function Ac(a){return Ec.call(this,a,this.week(),this.weekday(),this.localeData()._week.dow,this.localeData()._week.doy)}function Bc(a){return Ec.call(this,a,this.isoWeek(),this.isoWeekday(),1,4)}function Cc(){return xa(this.year(),1,4)}function Dc(){var a=this.localeData()._week;return xa(this.year(),a.dow,a.doy)}function Ec(a,b,c,d,e){var f;return null==a?wa(this,d,e).year:(f=xa(a,d,e),b>f&&(b=f),Fc.call(this,a,b,c,d,e))}function Fc(a,b,c,d,e){var f=va(a,b,c,d,e),g=ta(f.year,0,f.dayOfYear);return this.year(g.getUTCFullYear()),this.month(g.getUTCMonth()),this.date(g.getUTCDate()),this}
     314// MOMENTS
     315function Gc(a){return null==a?Math.ceil((this.month()+1)/3):this.month(3*(a-1)+this.month()%3)}
     316// HELPERS
     317// MOMENTS
     318function Hc(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function Ic(a,b){b[ge]=u(1e3*("0."+a))}
     319// MOMENTS
     320function Jc(){return this._isUTC?"UTC":""}function Kc(){return this._isUTC?"Coordinated Universal Time":""}function Lc(a){return sb(1e3*a)}function Mc(){return sb.apply(null,arguments).parseZone()}function Nc(a){return a}function Oc(a,b,c,d){var e=bb(),f=k().set(d,b);return e[c](f,a)}function Pc(a,b,c){if(f(a)&&(b=a,a=void 0),a=a||"",null!=b)return Oc(a,b,c,"month");var d,e=[];for(d=0;d<12;d++)e[d]=Oc(a,d,c,"month");return e}
     321// ()
     322// (5)
     323// (fmt, 5)
     324// (fmt)
     325// (true)
     326// (true, 5)
     327// (true, fmt, 5)
     328// (true, fmt)
     329function Qc(a,b,c,d){"boolean"==typeof a?(f(b)&&(c=b,b=void 0),b=b||""):(b=a,c=b,a=!1,f(b)&&(c=b,b=void 0),b=b||"");var e=bb(),g=a?e._week.dow:0;if(null!=c)return Oc(b,(c+g)%7,d,"day");var h,i=[];for(h=0;h<7;h++)i[h]=Oc(b,(h+g)%7,d,"day");return i}function Rc(a,b){return Pc(a,b,"months")}function Sc(a,b){return Pc(a,b,"monthsShort")}function Tc(a,b,c){return Qc(a,b,c,"weekdays")}function Uc(a,b,c){return Qc(a,b,c,"weekdaysShort")}function Vc(a,b,c){return Qc(a,b,c,"weekdaysMin")}function Wc(){var a=this._data;return this._milliseconds=Ze(this._milliseconds),this._days=Ze(this._days),this._months=Ze(this._months),a.milliseconds=Ze(a.milliseconds),a.seconds=Ze(a.seconds),a.minutes=Ze(a.minutes),a.hours=Ze(a.hours),a.months=Ze(a.months),a.years=Ze(a.years),this}function Xc(a,b,c,d){var e=Ob(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}
     330// supports only 2.0-style add(1, 's') or add(duration)
     331function Yc(a,b){return Xc(this,a,b,1)}
     332// supports only 2.0-style subtract(1, 's') or subtract(duration)
     333function Zc(a,b){return Xc(this,a,b,-1)}function $c(a){return a<0?Math.floor(a):Math.ceil(a)}function _c(){var a,b,c,d,e,f=this._milliseconds,g=this._days,h=this._months,i=this._data;
     334// if we have a mix of positive and negative values, bubble down first
     335// check: https://github.com/moment/moment/issues/2166
     336// The following code bubbles up values, see the tests for
     337// examples of what that means.
     338// convert days to months
     339// 12 months -> 1 year
     340return f>=0&&g>=0&&h>=0||f<=0&&g<=0&&h<=0||(f+=864e5*$c(bd(h)+g),g=0,h=0),i.milliseconds=f%1e3,a=t(f/1e3),i.seconds=a%60,b=t(a/60),i.minutes=b%60,c=t(b/60),i.hours=c%24,g+=t(c/24),e=t(ad(g)),h+=e,g-=$c(bd(e)),d=t(h/12),h%=12,i.days=g,i.months=h,i.years=d,this}function ad(a){
     341// 400 years have 146097 days (taking into account leap year rules)
     342// 400 years have 12 months === 4800
     343return 4800*a/146097}function bd(a){
     344// the reverse of daysToMonths
     345return 146097*a/4800}function cd(a){var b,c,d=this._milliseconds;if(a=K(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+ad(b),"month"===a?c:c/12;switch(
     346// handle milliseconds separately because of floating point math errors (issue #1867)
     347b=this._days+Math.round(bd(this._months)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;
     348// Math.floor prevents floating point math errors here
     349case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}
     350// TODO: Use this.as('ms')?
     351function dd(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*u(this._months/12)}function ed(a){return function(){return this.as(a)}}function fd(a){return a=K(a),this[a+"s"]()}function gd(a){return function(){return this._data[a]}}function hd(){return t(this.days()/7)}
     352// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
     353function id(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function jd(a,b,c){var d=Ob(a).abs(),e=of(d.as("s")),f=of(d.as("m")),g=of(d.as("h")),h=of(d.as("d")),i=of(d.as("M")),j=of(d.as("y")),k=e<pf.s&&["s",e]||f<=1&&["m"]||f<pf.m&&["mm",f]||g<=1&&["h"]||g<pf.h&&["hh",g]||h<=1&&["d"]||h<pf.d&&["dd",h]||i<=1&&["M"]||i<pf.M&&["MM",i]||j<=1&&["y"]||["yy",j];return k[2]=b,k[3]=+a>0,k[4]=c,id.apply(null,k)}
     354// This function allows you to set the rounding function for relative time strings
     355function kd(a){return void 0===a?of:"function"==typeof a&&(of=a,!0)}
     356// This function allows you to set a threshold for relative time strings
     357function ld(a,b){return void 0!==pf[a]&&(void 0===b?pf[a]:(pf[a]=b,!0))}function md(a){var b=this.localeData(),c=jd(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function nd(){
     358// for ISO strings we do not use the normal bubbling rules:
     359//  * milliseconds bubble up until they become hours
     360//  * days do not bubble at all
     361//  * months bubble up until they become years
     362// This is because there is no context-free conversion between hours and days
     363// (think of clock changes)
     364// and also not between days and months (28-31 days per month)
     365var a,b,c,d=qf(this._milliseconds)/1e3,e=qf(this._days),f=qf(this._months);
     366// 3600 seconds -> 60 minutes -> 1 hour
     367a=t(d/60),b=t(a/60),d%=60,a%=60,
     368// 12 months -> 1 year
     369c=t(f/12),f%=12;
     370// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
     371var g=c,h=f,i=e,j=b,k=a,l=d,m=this.asSeconds();return m?(m<0?"-":"")+"P"+(g?g+"Y":"")+(h?h+"M":"")+(i?i+"D":"")+(j||k||l?"T":"")+(j?j+"H":"")+(k?k+"M":"")+(l?l+"S":""):"P0D"}var od,pd;pd=Array.prototype.some?Array.prototype.some:function(a){for(var b=Object(this),c=b.length>>>0,d=0;d<c;d++)if(d in b&&a.call(this,b[d],d,b))return!0;return!1};var qd=pd,rd=a.momentProperties=[],sd=!1,td={};a.suppressDeprecationWarnings=!1,a.deprecationHandler=null;var ud;ud=Object.keys?Object.keys:function(a){var b,c=[];for(b in a)i(a,b)&&c.push(b);return c};var vd,wd=ud,xd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},yd={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},zd="Invalid date",Ad="%d",Bd=/\d{1,2}/,Cd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Dd={},Ed={},Fd=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,Gd=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Hd={},Id={},Jd=/\d/,Kd=/\d\d/,Ld=/\d{3}/,Md=/\d{4}/,Nd=/[+-]?\d{6}/,Od=/\d\d?/,Pd=/\d\d\d\d?/,Qd=/\d\d\d\d\d\d?/,Rd=/\d{1,3}/,Sd=/\d{1,4}/,Td=/[+-]?\d{1,6}/,Ud=/\d+/,Vd=/[+-]?\d+/,Wd=/Z|[+-]\d\d:?\d\d/gi,Xd=/Z|[+-]\d\d(?::?\d\d)?/gi,Yd=/[+-]?\d+(\.\d{1,3})?/,Zd=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,$d={},_d={},ae=0,be=1,ce=2,de=3,ee=4,fe=5,ge=6,he=7,ie=8;vd=Array.prototype.indexOf?Array.prototype.indexOf:function(a){
     372// I know
     373var b;for(b=0;b<this.length;++b)if(this[b]===a)return b;return-1};var je=vd;
     374// FORMATTING
     375U("M",["MM",2],"Mo",function(){return this.month()+1}),U("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),U("MMMM",0,0,function(a){return this.localeData().months(this,a)}),
     376// ALIASES
     377J("month","M"),
     378// PRIORITY
     379M("month",8),
     380// PARSING
     381Z("M",Od),Z("MM",Od,Kd),Z("MMM",function(a,b){return b.monthsShortRegex(a)}),Z("MMMM",function(a,b){return b.monthsRegex(a)}),ba(["M","MM"],function(a,b){b[be]=u(a)-1}),ba(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);
     382// if we didn't find a month name, mark the date as invalid.
     383null!=e?b[be]=e:m(c).invalidMonth=a});
     384// LOCALES
     385var ke=/D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,le="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),me="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),ne=Zd,oe=Zd;
     386// FORMATTING
     387U("Y",0,0,function(){var a=this.year();return a<=9999?""+a:"+"+a}),U(0,["YY",2],0,function(){return this.year()%100}),U(0,["YYYY",4],0,"year"),U(0,["YYYYY",5],0,"year"),U(0,["YYYYYY",6,!0],0,"year"),
     388// ALIASES
     389J("year","y"),
     390// PRIORITIES
     391M("year",1),
     392// PARSING
     393Z("Y",Vd),Z("YY",Od,Kd),Z("YYYY",Sd,Md),Z("YYYYY",Td,Nd),Z("YYYYYY",Td,Nd),ba(["YYYYY","YYYYYY"],ae),ba("YYYY",function(b,c){c[ae]=2===b.length?a.parseTwoDigitYear(b):u(b)}),ba("YY",function(b,c){c[ae]=a.parseTwoDigitYear(b)}),ba("Y",function(a,b){b[ae]=parseInt(a,10)}),
     394// HOOKS
     395a.parseTwoDigitYear=function(a){return u(a)+(u(a)>68?1900:2e3)};
     396// MOMENTS
     397var pe=O("FullYear",!0);
     398// FORMATTING
     399U("w",["ww",2],"wo","week"),U("W",["WW",2],"Wo","isoWeek"),
     400// ALIASES
     401J("week","w"),J("isoWeek","W"),
     402// PRIORITIES
     403M("week",5),M("isoWeek",5),
     404// PARSING
     405Z("w",Od),Z("ww",Od,Kd),Z("W",Od),Z("WW",Od,Kd),ca(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=u(a)});var qe={dow:0,// Sunday is the first day of the week.
     406doy:6};
     407// FORMATTING
     408U("d",0,"do","day"),U("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),U("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),U("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),U("e",0,0,"weekday"),U("E",0,0,"isoWeekday"),
     409// ALIASES
     410J("day","d"),J("weekday","e"),J("isoWeekday","E"),
     411// PRIORITY
     412M("day",11),M("weekday",11),M("isoWeekday",11),
     413// PARSING
     414Z("d",Od),Z("e",Od),Z("E",Od),Z("dd",function(a,b){return b.weekdaysMinRegex(a)}),Z("ddd",function(a,b){return b.weekdaysShortRegex(a)}),Z("dddd",function(a,b){return b.weekdaysRegex(a)}),ca(["dd","ddd","dddd"],function(a,b,c,d){var e=c._locale.weekdaysParse(a,d,c._strict);
     415// if we didn't get a weekday name, mark the date as invalid
     416null!=e?b.d=e:m(c).invalidWeekday=a}),ca(["d","e","E"],function(a,b,c,d){b[d]=u(a)});
     417// LOCALES
     418var re="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),se="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),te="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ue=Zd,ve=Zd,we=Zd;U("H",["HH",2],0,"hour"),U("h",["hh",2],0,Ra),U("k",["kk",2],0,Sa),U("hmm",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)}),U("hmmss",0,0,function(){return""+Ra.apply(this)+T(this.minutes(),2)+T(this.seconds(),2)}),U("Hmm",0,0,function(){return""+this.hours()+T(this.minutes(),2)}),U("Hmmss",0,0,function(){return""+this.hours()+T(this.minutes(),2)+T(this.seconds(),2)}),Ta("a",!0),Ta("A",!1),
     419// ALIASES
     420J("hour","h"),
     421// PRIORITY
     422M("hour",13),Z("a",Ua),Z("A",Ua),Z("H",Od),Z("h",Od),Z("HH",Od,Kd),Z("hh",Od,Kd),Z("hmm",Pd),Z("hmmss",Qd),Z("Hmm",Pd),Z("Hmmss",Qd),ba(["H","HH"],de),ba(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),ba(["h","hh"],function(a,b,c){b[de]=u(a),m(c).bigHour=!0}),ba("hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d)),m(c).bigHour=!0}),ba("hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e)),m(c).bigHour=!0}),ba("Hmm",function(a,b,c){var d=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d))}),ba("Hmmss",function(a,b,c){var d=a.length-4,e=a.length-2;b[de]=u(a.substr(0,d)),b[ee]=u(a.substr(d,2)),b[fe]=u(a.substr(e))});var xe,ye=/[ap]\.?m?\.?/i,ze=O("Hours",!0),Ae={calendar:xd,longDateFormat:yd,invalidDate:zd,ordinal:Ad,ordinalParse:Bd,relativeTime:Cd,months:le,monthsShort:me,week:qe,weekdays:re,weekdaysMin:te,weekdaysShort:se,meridiemParse:ye},Be={},Ce={},De=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ee=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Fe=/Z|[+-]\d\d(?::?\d\d)?/,Ge=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],
     423// YYYYMM is NOT allowed by the standard
     424["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/]],He=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],Ie=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=x("value provided is not in a recognized ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),
     425// constant that refers to the ISO standard
     426a.ISO_8601=function(){};var Je=x("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a<this?this:a:o()}),Ke=x("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/",function(){var a=sb.apply(null,arguments);return this.isValid()&&a.isValid()?a>this?this:a:o()}),Le=function(){return Date.now?Date.now():+new Date};zb("Z",":"),zb("ZZ",""),
     427// PARSING
     428Z("Z",Xd),Z("ZZ",Xd),ba(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ab(Xd,a)});
     429// HELPERS
     430// timezone chunker
     431// '+10:00' > ['10',  '00']
     432// '-1530'  > ['-15', '30']
     433var Me=/([\+\-]|\d\d)/gi;
     434// HOOKS
     435// This function will be called whenever a moment is mutated.
     436// It is intended to keep the offset in sync with the timezone.
     437a.updateOffset=function(){};
     438// ASP.NET json date format regex
     439var Ne=/^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/,Oe=/^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;Ob.fn=wb.prototype;var Pe=Sb(1,"add"),Qe=Sb(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ",a.defaultFormatUtc="YYYY-MM-DDTHH:mm:ss[Z]";var Re=x("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});
     440// FORMATTING
     441U(0,["gg",2],0,function(){return this.weekYear()%100}),U(0,["GG",2],0,function(){return this.isoWeekYear()%100}),zc("gggg","weekYear"),zc("ggggg","weekYear"),zc("GGGG","isoWeekYear"),zc("GGGGG","isoWeekYear"),
     442// ALIASES
     443J("weekYear","gg"),J("isoWeekYear","GG"),
     444// PRIORITY
     445M("weekYear",1),M("isoWeekYear",1),
     446// PARSING
     447Z("G",Vd),Z("g",Vd),Z("GG",Od,Kd),Z("gg",Od,Kd),Z("GGGG",Sd,Md),Z("gggg",Sd,Md),Z("GGGGG",Td,Nd),Z("ggggg",Td,Nd),ca(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=u(a)}),ca(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),
     448// FORMATTING
     449U("Q",0,"Qo","quarter"),
     450// ALIASES
     451J("quarter","Q"),
     452// PRIORITY
     453M("quarter",7),
     454// PARSING
     455Z("Q",Jd),ba("Q",function(a,b){b[be]=3*(u(a)-1)}),
     456// FORMATTING
     457U("D",["DD",2],"Do","date"),
     458// ALIASES
     459J("date","D"),
     460// PRIOROITY
     461M("date",9),
     462// PARSING
     463Z("D",Od),Z("DD",Od,Kd),Z("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),ba(["D","DD"],ce),ba("Do",function(a,b){b[ce]=u(a.match(Od)[0],10)});
     464// MOMENTS
     465var Se=O("Date",!0);
     466// FORMATTING
     467U("DDD",["DDDD",3],"DDDo","dayOfYear"),
     468// ALIASES
     469J("dayOfYear","DDD"),
     470// PRIORITY
     471M("dayOfYear",4),
     472// PARSING
     473Z("DDD",Rd),Z("DDDD",Ld),ba(["DDD","DDDD"],function(a,b,c){c._dayOfYear=u(a)}),
     474// FORMATTING
     475U("m",["mm",2],0,"minute"),
     476// ALIASES
     477J("minute","m"),
     478// PRIORITY
     479M("minute",14),
     480// PARSING
     481Z("m",Od),Z("mm",Od,Kd),ba(["m","mm"],ee);
     482// MOMENTS
     483var Te=O("Minutes",!1);
     484// FORMATTING
     485U("s",["ss",2],0,"second"),
     486// ALIASES
     487J("second","s"),
     488// PRIORITY
     489M("second",15),
     490// PARSING
     491Z("s",Od),Z("ss",Od,Kd),ba(["s","ss"],fe);
     492// MOMENTS
     493var Ue=O("Seconds",!1);
     494// FORMATTING
     495U("S",0,0,function(){return~~(this.millisecond()/100)}),U(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),U(0,["SSS",3],0,"millisecond"),U(0,["SSSS",4],0,function(){return 10*this.millisecond()}),U(0,["SSSSS",5],0,function(){return 100*this.millisecond()}),U(0,["SSSSSS",6],0,function(){return 1e3*this.millisecond()}),U(0,["SSSSSSS",7],0,function(){return 1e4*this.millisecond()}),U(0,["SSSSSSSS",8],0,function(){return 1e5*this.millisecond()}),U(0,["SSSSSSSSS",9],0,function(){return 1e6*this.millisecond()}),
     496// ALIASES
     497J("millisecond","ms"),
     498// PRIORITY
     499M("millisecond",16),
     500// PARSING
     501Z("S",Rd,Jd),Z("SS",Rd,Kd),Z("SSS",Rd,Ld);var Ve;for(Ve="SSSS";Ve.length<=9;Ve+="S")Z(Ve,Ud);for(Ve="S";Ve.length<=9;Ve+="S")ba(Ve,Ic);
     502// MOMENTS
     503var We=O("Milliseconds",!1);
     504// FORMATTING
     505U("z",0,0,"zoneAbbr"),U("zz",0,0,"zoneName");var Xe=r.prototype;Xe.add=Pe,Xe.calendar=Vb,Xe.clone=Wb,Xe.diff=bc,Xe.endOf=oc,Xe.format=gc,Xe.from=hc,Xe.fromNow=ic,Xe.to=jc,Xe.toNow=kc,Xe.get=R,Xe.invalidAt=xc,Xe.isAfter=Xb,Xe.isBefore=Yb,Xe.isBetween=Zb,Xe.isSame=$b,Xe.isSameOrAfter=_b,Xe.isSameOrBefore=ac,Xe.isValid=vc,Xe.lang=Re,Xe.locale=lc,Xe.localeData=mc,Xe.max=Ke,Xe.min=Je,Xe.parsingFlags=wc,Xe.set=S,Xe.startOf=nc,Xe.subtract=Qe,Xe.toArray=sc,Xe.toObject=tc,Xe.toDate=rc,Xe.toISOString=ec,Xe.inspect=fc,Xe.toJSON=uc,Xe.toString=dc,Xe.unix=qc,Xe.valueOf=pc,Xe.creationData=yc,
     506// Year
     507Xe.year=pe,Xe.isLeapYear=ra,
     508// Week Year
     509Xe.weekYear=Ac,Xe.isoWeekYear=Bc,
     510// Quarter
     511Xe.quarter=Xe.quarters=Gc,
     512// Month
     513Xe.month=ka,Xe.daysInMonth=la,
     514// Week
     515Xe.week=Xe.weeks=Ba,Xe.isoWeek=Xe.isoWeeks=Ca,Xe.weeksInYear=Dc,Xe.isoWeeksInYear=Cc,
     516// Day
     517Xe.date=Se,Xe.day=Xe.days=Ka,Xe.weekday=La,Xe.isoWeekday=Ma,Xe.dayOfYear=Hc,
     518// Hour
     519Xe.hour=Xe.hours=ze,
     520// Minute
     521Xe.minute=Xe.minutes=Te,
     522// Second
     523Xe.second=Xe.seconds=Ue,
     524// Millisecond
     525Xe.millisecond=Xe.milliseconds=We,
     526// Offset
     527Xe.utcOffset=Db,Xe.utc=Fb,Xe.local=Gb,Xe.parseZone=Hb,Xe.hasAlignedHourOffset=Ib,Xe.isDST=Jb,Xe.isLocal=Lb,Xe.isUtcOffset=Mb,Xe.isUtc=Nb,Xe.isUTC=Nb,
     528// Timezone
     529Xe.zoneAbbr=Jc,Xe.zoneName=Kc,
     530// Deprecations
     531Xe.dates=x("dates accessor is deprecated. Use date instead.",Se),Xe.months=x("months accessor is deprecated. Use month instead",ka),Xe.years=x("years accessor is deprecated. Use year instead",pe),Xe.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",Eb),Xe.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",Kb);var Ye=C.prototype;Ye.calendar=D,Ye.longDateFormat=E,Ye.invalidDate=F,Ye.ordinal=G,Ye.preparse=Nc,Ye.postformat=Nc,Ye.relativeTime=H,Ye.pastFuture=I,Ye.set=A,
     532// Month
     533Ye.months=fa,Ye.monthsShort=ga,Ye.monthsParse=ia,Ye.monthsRegex=na,Ye.monthsShortRegex=ma,
     534// Week
     535Ye.week=ya,Ye.firstDayOfYear=Aa,Ye.firstDayOfWeek=za,
     536// Day of Week
     537Ye.weekdays=Fa,Ye.weekdaysMin=Ha,Ye.weekdaysShort=Ga,Ye.weekdaysParse=Ja,Ye.weekdaysRegex=Na,Ye.weekdaysShortRegex=Oa,Ye.weekdaysMinRegex=Pa,
     538// Hours
     539Ye.isPM=Va,Ye.meridiem=Wa,$a("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===u(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),
     540// Side effect imports
     541a.lang=x("moment.lang is deprecated. Use moment.locale instead.",$a),a.langData=x("moment.langData is deprecated. Use moment.localeData instead.",bb);var Ze=Math.abs,$e=ed("ms"),_e=ed("s"),af=ed("m"),bf=ed("h"),cf=ed("d"),df=ed("w"),ef=ed("M"),ff=ed("y"),gf=gd("milliseconds"),hf=gd("seconds"),jf=gd("minutes"),kf=gd("hours"),lf=gd("days"),mf=gd("months"),nf=gd("years"),of=Math.round,pf={s:45,// seconds to minute
     542m:45,// minutes to hour
     543h:22,// hours to day
     544d:26,// days to month
     545M:11},qf=Math.abs,rf=wb.prototype;
     546// Deprecations
     547// Side effect imports
     548// FORMATTING
     549// PARSING
     550// Side effect imports
     551return rf.abs=Wc,rf.add=Yc,rf.subtract=Zc,rf.as=cd,rf.asMilliseconds=$e,rf.asSeconds=_e,rf.asMinutes=af,rf.asHours=bf,rf.asDays=cf,rf.asWeeks=df,rf.asMonths=ef,rf.asYears=ff,rf.valueOf=dd,rf._bubble=_c,rf.get=fd,rf.milliseconds=gf,rf.seconds=hf,rf.minutes=jf,rf.hours=kf,rf.days=lf,rf.weeks=hd,rf.months=mf,rf.years=nf,rf.humanize=md,rf.toISOString=nd,rf.toString=nd,rf.toJSON=nd,rf.locale=lc,rf.localeData=mc,rf.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",nd),rf.lang=Re,U("X",0,0,"unix"),U("x",0,0,"valueOf"),Z("x",Vd),Z("X",Yd),ba("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),ba("x",function(a,b,c){c._d=new Date(u(a))}),a.version="2.17.1",b(sb),a.fn=Xe,a.min=ub,a.max=vb,a.now=Le,a.utc=k,a.unix=Lc,a.months=Rc,a.isDate=g,a.locale=$a,a.invalid=o,a.duration=Ob,a.isMoment=s,a.weekdays=Tc,a.parseZone=Mc,a.localeData=bb,a.isDuration=xb,a.monthsShort=Sc,a.weekdaysMin=Vc,a.defineLocale=_a,a.updateLocale=ab,a.locales=cb,a.weekdaysShort=Uc,a.normalizeUnits=K,a.relativeTimeRounding=kd,a.relativeTimeThreshold=ld,a.calendarFormat=Ub,a.prototype=Xe,a});
     552 No newline at end of file
  • src/wp-includes/js/wp-date.js

     
     1/* global _wpDateSettings */
     2window.wp = window.wp || {};
     3
     4(function (moment, settings) {
     5        /**
     6         * Date formatting utilities.
     7         *
     8         * `wp.date` provides date formatting utilities similar to the `date()` and
     9         * `date_i18n()` functions in PHP/WordPress. Internally, it uses the
     10         * Moment.js library to provide this functionality.
     11         *
     12         * Unlike the functions in WordPress, {@link wp.date.date} formats the
     13         * date using the site's timezone. For UTC-based formatting, use
     14         * {@link wp.date.gmdate} instead. You can also use {@link wp.date.format}
     15         * directly if you don't need the timezone handling.
     16         *
     17         * @namespace wp.date
     18         */
     19        wp.date = {
     20                /**
     21                 * Map of PHP formats to Moment.js formats.
     22                 *
     23                 * These are used internally by {@link wp.date.format}, and are either
     24                 * a string representing the corresponding Moment.js format code, or a
     25                 * function which returns the formatted string.
     26                 *
     27                 * This should only be used through {@link wp.date.format}, not
     28                 * directly.
     29                 *
     30                 * @access protected
     31                 * @type {Object}
     32                 */
     33                formatMap: {
     34                        // Day
     35                        'd': 'DD',
     36                        'D': 'ddd',
     37                        'j': 'D',
     38                        'l': 'dddd',
     39                        'N': 'E',
     40
     41                        /**
     42                         * Gets the ordinal suffix.
     43                         *
     44                         * @param {moment} date Moment instance.
     45                         * @return {string} Formatted date.
     46                         */
     47                        'S': function ( date ) {
     48                                // Do - D
     49                                var num = date.format( 'D' );
     50                                var withOrdinal = date.format( 'Do' );
     51                                return withOrdinal.replace( num, '' );
     52                        },
     53                        'w': 'd',
     54                        /**
     55                         * Gets the day of the year (zero-indexed).
     56                         *
     57                         * @param {moment} date Moment instance.
     58                         * @return {string} Formatted date.
     59                         */
     60                        'z': function ( date ) {
     61                                // DDD - 1
     62                                return '' + parseInt( date.format( 'DDD' ), 10 ) - 1;
     63                        },
     64
     65                        // Week
     66                        'W': 'W',
     67
     68                        // Month
     69                        'F': 'MMMM',
     70                        'm': 'MM',
     71                        'M': 'MMM',
     72                        'n': 'M',
     73                        /**
     74                         * Gets the days in the month.
     75                         *
     76                         * @param {moment} date Moment instance.
     77                         * @return {string} Formatted date.
     78                         */
     79                        't': function ( date ) {
     80                                return date.daysInMonth();
     81                        },
     82
     83                        // Year
     84                        /**
     85                         * Gets whether the current year is a leap year.
     86                         *
     87                         * @param {moment} date Moment instance.
     88                         * @return {string} Formatted date.
     89                         */
     90                        'L': function ( date ) {
     91                                return date.isLeapYear() ? '1' : '0';
     92                        },
     93                        'o': 'GGGG',
     94                        'Y': 'YYYY',
     95                        'y': 'YY',
     96
     97                        // Time
     98                        'a': 'a',
     99                        'A': 'A',
     100                        /**
     101                         * Gets the current time in Swatch Internet Time (.beats).
     102                         *
     103                         * @param {moment} date Moment instance.
     104                         * @return {string} Formatted date.
     105                         */
     106                        'B': function ( date ) {
     107                                var timezoned = moment( date ).utcOffset( 60 );
     108                                var seconds = parseInt( timezoned.format( 's' ), 10 ),
     109                                        minutes = parseInt( timezoned.format( 'm' ), 10 ),
     110                                        hours   = parseInt( timezoned.format( 'H' ), 10 );
     111
     112                                return parseInt(
     113                                        (
     114                                                seconds
     115                                                + ( minutes * wp.date.MINUTE_IN_SECONDS )
     116                                                + ( hours * wp.date.HOUR_IN_SECONDS )
     117                                        ) / 86.4,
     118                                        10
     119                                );
     120                        },
     121                        'g': 'h',
     122                        'G': 'H',
     123                        'h': 'hh',
     124                        'H': 'HH',
     125                        'i': 'mm',
     126                        's': 'ss',
     127                        'u': 'SSSSSS',
     128                        'v': 'SSS',
     129
     130                        // Timezone
     131                        'e': 'zz',
     132                        /**
     133                         * Gets whether the timezone is in DST currently.
     134                         *
     135                         * @param {moment} date Moment instance.
     136                         * @return {string} Formatted date.
     137                         */
     138                        'I': function ( date ) {
     139                                return date.isDST() ? '1' : '0';
     140                        },
     141                        'O': 'ZZ',
     142                        'P': 'Z',
     143                        'T': 'z',
     144                        /**
     145                         * Gets the timezone offset in seconds.
     146                         *
     147                         * @param {moment} date Moment instance.
     148                         * @return {string} Formatted date.
     149                         */
     150                        'Z': function ( date ) {
     151                                // Timezone offset in seconds.
     152                                var offset = date.format( 'Z' );
     153                                var sign = offset[0] === '-' ? -1 : 1;
     154                                var parts = offset.substring( 1 ).split( ':' );
     155
     156                                return sign * ( parts[0] * wp.date.HOUR_IN_MINUTES + parts[1] ) * wp.date.MINUTE_IN_SECONDS;
     157                        },
     158
     159                        // Full date/time
     160                        'c': 'YYYY-MM-DDTHH:mm:ssZ', // .toISOString
     161                        'r': 'ddd, D MMM YYYY HH:mm:ss ZZ',
     162                        'U': 'X',
     163                },
     164
     165                /**
     166                 * Formats a date. Does not alter the date's timezone.
     167                 *
     168                 * @param {string}                    format  PHP-style formatting string.
     169                 *                                            See php.net/date
     170                 * @param {(Date|string|moment|null)} date    Date object or string,
     171                 *                                            parsable by moment.js.
     172                 * @return {string} Formatted date.
     173                 */
     174                format: function ( format, date ) {
     175                        date = date || new Date();
     176
     177                        var momentDate = moment( date );
     178                        var newformat = [], i, char;
     179                        for ( i = 0; i < format.length; i++ ) {
     180                                char = format[ i ];
     181
     182                                // Is this an escape?
     183                                if ( '\\' === char ) {
     184                                        // Add next character, then move on.
     185                                        i++;
     186                                        newformat.push( '[' + format[ i ] + ']' );
     187                                        continue;
     188                                }
     189
     190                                if ( char in wp.date.formatMap ) {
     191                                        if ( typeof wp.date.formatMap[ char ] !== 'string' ) {
     192                                                // If the format is a function, call it.
     193                                                newformat.push( '[' + wp.date.formatMap[ char ]( date ) + ']' );
     194                                        } else {
     195                                                // Otherwise, add as a formatting string.
     196                                                newformat.push( wp.date.formatMap[ char ] );
     197                                        }
     198                                } else {
     199                                        newformat.push( '[' + char + ']' );
     200                                }
     201                        }
     202
     203                        // Join with [] between to separate characters, and replace
     204                        // unneeded separators with static text.
     205                        newformat = newformat.join( '[]' );
     206
     207                        return momentDate.format( newformat );
     208                },
     209
     210                /**
     211                 * Adds a locale to moment, using the format supplied by `wp_localize_script()`.
     212                 *
     213                 * @param {Object} settings Settings, including locale data.
     214                 */
     215                setupLocale: function ( settings ) {
     216                        // Backup and restore current locale.
     217                        var currentLocale = moment.locale();
     218
     219                        moment.defineLocale( settings.l10n.locale, {
     220                                // Inherit anything missing from the default locale.
     221                                parentLocale: currentLocale,
     222
     223                                months: settings.l10n.months,
     224                                monthsShort: settings.l10n.monthsShort,
     225                                weekdays: settings.l10n.weekdays,
     226                                weekdaysShort: settings.l10n.weekdaysShort,
     227                                meridiem: function ( hour, minute, isLowercase ) {
     228                                        if ( hour < 12 ) {
     229                                                return isLowercase ? settings.l10n.meridiem.am : settings.l10n.meridiem.AM;
     230                                        } else {
     231                                                return isLowercase ? settings.l10n.meridiem.pm : settings.l10n.meridiem.PM;
     232                                        }
     233                                },
     234
     235                                longDateFormat: {
     236                                        LT: settings.formats.time,
     237                                        LTS: null,
     238                                        L: null,
     239                                        LL: settings.formats.date,
     240                                        LLL: settings.formats.datetime,
     241                                        LLLL: null
     242                                },
     243
     244                                // From human_time_diff?
     245                                // Set to `(number, withoutSuffix, key, isFuture) => {}` instead.
     246                                relativeTime: {
     247                                        future: settings.l10n.relative.future,
     248                                        past:   settings.l10n.relative.past,
     249
     250                                        s:  "seconds",
     251                                        m:  "a minute",
     252                                        mm: "%d minutes",
     253                                        h:  "an hour",
     254                                        hh: "%d hours",
     255                                        d:  "a day",
     256                                        dd: "%d days",
     257                                        M:  "a month",
     258                                        MM: "%d months",
     259                                        y:  "a year",
     260                                        yy: "%d years"
     261                                },
     262                        });
     263
     264                        moment.locale( currentLocale );
     265                },
     266
     267                /**
     268                 * Formats a date (like `date()` in PHP), in the site's timezone.
     269                 *
     270                 * @param {string}                    format  PHP-style formatting string.
     271                 *                                            See php.net/date
     272                 * @param {(Date|string|moment|null)} date    Date object or string,
     273                 *                                            parsable by moment.js.
     274                 *
     275                 * @return {string} Formatted date.
     276                 */
     277                date: function ( format, date ) {
     278                        date = date || new Date();
     279
     280                        var offset = settings.timezone.offset * wp.date.HOUR_IN_MINUTES;
     281                        var dateMoment = moment( date ).utcOffset( offset );
     282
     283                        return wp.date.format( format, dateMoment );
     284                },
     285
     286                /**
     287                 * Formats a date (like `date()` in PHP), in the UTC timezone.
     288                 *
     289                 * @param {string}                    format  PHP-style formatting string.
     290                 *                                            See php.net/date
     291                 * @param {(Date|string|moment|null)} date    Date object or string,
     292                 *                                            parsable by moment.js.
     293                 *
     294                 * @return {string} Formatted date.
     295                 */
     296                gmdate: function ( format, date ) {
     297                        date = date || new Date();
     298
     299                        var dateMoment = moment( date ).utc();
     300
     301                        return wp.date.format( format, dateMoment );
     302                },
     303
     304                /**
     305                 * Formats a date (like `date_i18n()` in PHP).
     306                 *
     307                 * @param {string}                    format  PHP-style formatting string.
     308                 *                                            See php.net/date
     309                 * @param {(Date|string|moment|null)} date    Date object or string,
     310                 *                                            parsable by moment.js.
     311                 * @param {boolean}                   gmt     True for GMT/UTC, false for
     312                 *                                            site's timezone.
     313                 *
     314                 * @return {string} Formatted date.
     315                 */
     316                date_i18n: function ( format, date, gmt ) {
     317                        // Defaults.
     318                        date = date || new Date();
     319                        gmt = gmt || false;
     320
     321                        var offset = gmt ? 0 : settings.timezone.offset * wp.date.HOUR_IN_MINUTES;
     322
     323                        // Convert to moment object.
     324                        var dateMoment = moment( date ).utcOffset( offset );
     325
     326                        // Set the locale.
     327                        dateMoment.locale( settings.l10n.locale );
     328
     329                        // Format and return.
     330                        return wp.date.format( format, dateMoment );
     331                },
     332        };
     333
     334        // Date constants.
     335        /**
     336         * Number of seconds in one minute.
     337         *
     338         * @type {Number}
     339         */
     340        wp.date.MINUTE_IN_SECONDS = 60;
     341
     342        /**
     343         * Number of minutes in one hour.
     344         *
     345         * @type {Number}
     346         */
     347        wp.date.HOUR_IN_MINUTES =   60;
     348
     349        /**
     350         * Number of seconds in one hour.
     351         *
     352         * @type {Number}
     353         */
     354        wp.date.HOUR_IN_SECONDS =   60 * wp.date.MINUTE_IN_SECONDS;
     355
     356        /**
     357         * Number of seconds in one (standard) day.
     358         *
     359         * @type {Number}
     360         */
     361        wp.date.DAY_IN_SECONDS =    24 * wp.date.HOUR_IN_SECONDS;
     362
     363        /**
     364         * Number of seconds in one (standard) week.
     365         *
     366         * @type {Number}
     367         */
     368        wp.date.WEEK_IN_SECONDS =    7 * wp.date.DAY_IN_SECONDS;
     369
     370        /**
     371         * Number of seconds in one 30-day month.
     372         *
     373         * @type {Number}
     374         */
     375        wp.date.MONTH_IN_SECONDS =  30 * wp.date.DAY_IN_SECONDS;
     376
     377        /**
     378         * Number of seconds in one 365-day year.
     379         *
     380         * @type {Number}
     381         */
     382        wp.date.YEAR_IN_SECONDS =  365 * wp.date.DAY_IN_SECONDS;
     383
     384        // Initialize.
     385        wp.date.setupLocale( settings );
     386
     387}(moment, wpDateSettings));
  • src/wp-includes/script-loader.php

     
    511511                'versionString' => 'wp/v2/',
    512512        ) );
    513513
     514        $scripts->add( 'moment', "/wp-includes/js/moment.js", array(), '2.17.1', 1 );
     515        $scripts->add( 'wp-date', "/wp-includes/js/wp-date$suffix.js", array( 'moment' ), false, 1 );
     516
     517        global $wp_locale;
     518        did_action( 'init' ) && $scripts->localize( 'wp-date', 'wpDateSettings', array(
     519                'l10n'    => array(
     520                        'locale'        => get_locale(),
     521                        'months'        => array_values( $wp_locale->month ),
     522                        'monthsShort'   => array_values( $wp_locale->month_abbrev ),
     523                        'weekdays'      => array_values( $wp_locale->weekday ),
     524                        'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
     525                        'meridiem'      => (object) $wp_locale->meridiem,
     526                        'relative' => array(
     527                                'future' => __( '%s from now' ),
     528                                'past'   => __( '%s ago' ),
     529                        ),
     530                ),
     531                'formats' => array(
     532                        'time'     => get_option( 'time_format', __( 'g:i a' ) ),
     533                        'date'     => get_option( 'date_format', __( 'F j, Y' ) ),
     534                        'datetime' => __( 'F j, Y g:i a' ),
     535                ),
     536                'timezone' => array(
     537                        'offset' => get_option( 'gmt_offset', 0 ),
     538                        'string' => get_option( 'timezone_string', 'UTC' ),
     539                ),
     540        ) );
     541
    514542        if ( is_admin() ) {
    515543                $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
    516544                did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(