uikit-sass-rails 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +15 -12
- data/lib/uikit/sass/rails/engine.rb +1 -1
- data/lib/uikit/sass/rails/version.rb +1 -1
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.otf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +525 -464
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/vendor/assets/javascripts/uikit.js +30 -3
- data/vendor/assets/javascripts/uikit/components/accordion.js +172 -0
- data/vendor/assets/javascripts/uikit/components/autocomplete.js +48 -27
- data/vendor/assets/javascripts/uikit/components/datepicker.js +2887 -97
- data/vendor/assets/javascripts/uikit/components/form-password.js +24 -19
- data/vendor/assets/javascripts/uikit/components/form-select.js +24 -18
- data/vendor/assets/javascripts/uikit/components/grid.js +524 -0
- data/vendor/assets/javascripts/uikit/components/htmleditor.js +46 -39
- data/vendor/assets/javascripts/uikit/components/lightbox.js +543 -0
- data/vendor/assets/javascripts/uikit/components/nestable.js +125 -98
- data/vendor/assets/javascripts/uikit/components/notify.js +34 -22
- data/vendor/assets/javascripts/uikit/components/pagination.js +24 -21
- data/vendor/assets/javascripts/uikit/components/parallax.js +400 -0
- data/vendor/assets/javascripts/uikit/components/search.js +19 -16
- data/vendor/assets/javascripts/uikit/components/slider.js +482 -0
- data/vendor/assets/javascripts/uikit/components/slideset.js +498 -0
- data/vendor/assets/javascripts/uikit/components/slideshow-fx.js +377 -0
- data/vendor/assets/javascripts/uikit/components/slideshow.js +540 -0
- data/vendor/assets/javascripts/uikit/components/sortable.js +392 -263
- data/vendor/assets/javascripts/uikit/components/sticky.js +127 -68
- data/vendor/assets/javascripts/uikit/components/timepicker.js +65 -42
- data/vendor/assets/javascripts/uikit/components/tooltip.js +220 -0
- data/vendor/assets/javascripts/uikit/components/upload.js +11 -10
- data/vendor/assets/javascripts/uikit/core/alert.js +66 -0
- data/vendor/assets/javascripts/uikit/core/button.js +154 -0
- data/vendor/assets/javascripts/uikit/core/core.js +717 -0
- data/vendor/assets/javascripts/uikit/{components → core}/cover.js +41 -35
- data/vendor/assets/javascripts/uikit/core/dropdown.js +296 -0
- data/vendor/assets/javascripts/uikit/core/grid.js +172 -0
- data/vendor/assets/javascripts/uikit/core/modal.js +323 -0
- data/vendor/assets/javascripts/uikit/core/nav.js +117 -0
- data/vendor/assets/javascripts/uikit/core/offcanvas.js +178 -0
- data/vendor/assets/javascripts/uikit/core/scrollspy.js +208 -0
- data/vendor/assets/javascripts/uikit/core/smooth-scroll.js +62 -0
- data/vendor/assets/javascripts/uikit/core/switcher.js +298 -0
- data/vendor/assets/javascripts/uikit/core/tab.js +159 -0
- data/vendor/assets/javascripts/uikit/core/toggle.js +117 -0
- data/vendor/assets/javascripts/uikit/core/touch.js +173 -0
- data/vendor/assets/javascripts/uikit/core/utility.js +157 -0
- data/vendor/assets/javascripts/uikit/uikit.js +1538 -871
- data/vendor/assets/stylesheets/extra/font-awesome.scss +4 -7
- data/vendor/assets/stylesheets/uikit.scss +22 -1
- data/vendor/assets/stylesheets/uikit/almost-flat.scss +22 -2
- data/vendor/assets/stylesheets/uikit/components/accordion.almost-flat.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.gradient.scss +45 -0
- data/vendor/assets/stylesheets/uikit/components/accordion.scss +43 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.almost-flat.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.gradient.scss +62 -0
- data/vendor/assets/stylesheets/uikit/components/autocomplete.scss +60 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.almost-flat.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.gradient.scss +158 -0
- data/vendor/assets/stylesheets/uikit/components/datepicker.scss +142 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.almost-flat.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.gradient.scss +152 -0
- data/vendor/assets/stylesheets/uikit/components/dotnav.scss +148 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.almost-flat.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.gradient.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-advanced.scss +92 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-file.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-password.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.almost-flat.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.gradient.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/form-select.scss +37 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.almost-flat.scss +282 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.gradient.scss +290 -0
- data/vendor/assets/stylesheets/uikit/components/htmleditor.scss +208 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.almost-flat.scss +137 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.gradient.scss +141 -0
- data/vendor/assets/stylesheets/uikit/components/nestable.scss +134 -0
- data/vendor/assets/stylesheets/uikit/components/notify.almost-flat.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.gradient.scss +112 -0
- data/vendor/assets/stylesheets/uikit/components/notify.scss +106 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.almost-flat.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.gradient.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/placeholder.scss +36 -0
- data/vendor/assets/stylesheets/uikit/components/progress.almost-flat.scss +130 -0
- data/vendor/assets/stylesheets/uikit/components/progress.gradient.scss +138 -0
- data/vendor/assets/stylesheets/uikit/components/progress.scss +118 -0
- data/vendor/assets/stylesheets/uikit/components/search.almost-flat.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.gradient.scss +216 -0
- data/vendor/assets/stylesheets/uikit/components/search.scss +214 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.almost-flat.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.gradient.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slidenav.scss +110 -0
- data/vendor/assets/stylesheets/uikit/components/slider.almost-flat.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.gradient.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slider.scss +105 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.almost-flat.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.gradient.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/slideshow.scss +166 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.almost-flat.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.gradient.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sortable.scss +90 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.almost-flat.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.gradient.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/sticky.scss +39 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.almost-flat.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.gradient.scss +129 -0
- data/vendor/assets/stylesheets/uikit/components/tooltip.scss +127 -0
- data/vendor/assets/stylesheets/uikit/components/upload.almost-flat.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.gradient.scss +11 -0
- data/vendor/assets/stylesheets/uikit/components/upload.scss +11 -0
- data/vendor/assets/stylesheets/uikit/gradient.scss +22 -2
- data/vendor/assets/stylesheets/uikit/uikit.almost-flat.scss +1768 -498
- data/vendor/assets/stylesheets/uikit/uikit.gradient.scss +1776 -512
- data/vendor/assets/stylesheets/uikit/uikit.scss +1722 -462
- metadata +92 -7
- data/vendor/assets/stylesheets/uikit/components/uikit.components.almost-flat.scss +0 -1586
- data/vendor/assets/stylesheets/uikit/components/uikit.components.gradient.scss +0 -1608
- data/vendor/assets/stylesheets/uikit/components/uikit.components.scss +0 -1489
Binary file
|
Binary file
|
Binary file
|
@@ -1,16 +1,43 @@
|
|
1
1
|
//= require uikit/uikit
|
2
2
|
|
3
|
+
// Core
|
4
|
+
//= require 'uikit/core/core'
|
5
|
+
//= require 'uikit/core/alert'
|
6
|
+
//= require 'uikit/core/button'
|
7
|
+
//= require 'uikit/core/cover'
|
8
|
+
//= require 'uikit/core/dropdown'
|
9
|
+
//= require 'uikit/core/grid'
|
10
|
+
//= require 'uikit/core/modal'
|
11
|
+
//= require 'uikit/core/nav'
|
12
|
+
//= require 'uikit/core/offcanvas'
|
13
|
+
//= require 'uikit/core/scrollspy'
|
14
|
+
//= require 'uikit/core/smooth-scroll'
|
15
|
+
//= require 'uikit/core/switcher'
|
16
|
+
//= require 'uikit/core/tab'
|
17
|
+
//= require 'uikit/core/toggle'
|
18
|
+
//= require 'uikit/core/touch'
|
19
|
+
//= require 'uikit/core/utility'
|
20
|
+
|
21
|
+
// Components
|
22
|
+
//= require 'uikit/components/accordion'
|
3
23
|
//= require 'uikit/components/autocomplete'
|
4
|
-
//= require 'uikit/components/cover'
|
5
24
|
//= require 'uikit/components/datepicker'
|
6
25
|
//= require 'uikit/components/form-password'
|
7
26
|
//= require 'uikit/components/form-select'
|
27
|
+
//= require 'uikit/components/grid'
|
8
28
|
//= require 'uikit/components/htmleditor'
|
9
|
-
//= require 'uikit/components/
|
29
|
+
//= require 'uikit/components/lightbox'
|
10
30
|
//= require 'uikit/components/notify'
|
31
|
+
//= require 'uikit/components/nestable'
|
11
32
|
//= require 'uikit/components/pagination'
|
33
|
+
//= require 'uikit/components/parallax'
|
12
34
|
//= require 'uikit/components/search'
|
35
|
+
//= require 'uikit/components/slider'
|
36
|
+
//= require 'uikit/components/slideset'
|
37
|
+
//= require 'uikit/components/slideshow-fx'
|
38
|
+
//= require 'uikit/components/slideshow'
|
13
39
|
//= require 'uikit/components/sortable'
|
14
40
|
//= require 'uikit/components/sticky'
|
15
41
|
//= require 'uikit/components/timepicker'
|
16
|
-
//= require 'uikit/components/
|
42
|
+
//= require 'uikit/components/tooltip'
|
43
|
+
//= require 'uikit/components/upload'
|
@@ -0,0 +1,172 @@
|
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
|
+
(function(addon) {
|
3
|
+
var component;
|
4
|
+
|
5
|
+
if (window.UIkit) {
|
6
|
+
component = addon(UIkit);
|
7
|
+
}
|
8
|
+
|
9
|
+
if (typeof define == "function" && define.amd) {
|
10
|
+
define("uikit-accordion", ["uikit"], function(){
|
11
|
+
return component || addon(UIkit);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
})(function(UI){
|
15
|
+
|
16
|
+
"use strict";
|
17
|
+
|
18
|
+
UI.component('accordion', {
|
19
|
+
|
20
|
+
defaults: {
|
21
|
+
showfirst : true,
|
22
|
+
collapse : true,
|
23
|
+
animate : true,
|
24
|
+
easing : 'swing',
|
25
|
+
duration : 300,
|
26
|
+
toggle : '.uk-accordion-title',
|
27
|
+
containers : '.uk-accordion-content',
|
28
|
+
clsactive : 'uk-active'
|
29
|
+
},
|
30
|
+
|
31
|
+
boot: function() {
|
32
|
+
|
33
|
+
// init code
|
34
|
+
UI.ready(function(context) {
|
35
|
+
|
36
|
+
setTimeout(function(){
|
37
|
+
|
38
|
+
UI.$("[data-uk-accordion]", context).each(function(){
|
39
|
+
|
40
|
+
var ele = UI.$(this);
|
41
|
+
|
42
|
+
if(!ele.data("accordion")) {
|
43
|
+
UI.accordion(ele, UI.Utils.options(ele.attr('data-uk-accordion')));
|
44
|
+
}
|
45
|
+
});
|
46
|
+
|
47
|
+
}, 0);
|
48
|
+
});
|
49
|
+
},
|
50
|
+
|
51
|
+
init: function() {
|
52
|
+
|
53
|
+
var $this = this;
|
54
|
+
|
55
|
+
this.element.on('click.uikit.accordion', this.options.toggle, function(e) {
|
56
|
+
|
57
|
+
e.preventDefault();
|
58
|
+
|
59
|
+
$this.toggleItem(UI.$(this).data('wrapper'), $this.options.animate, $this.options.collapse);
|
60
|
+
});
|
61
|
+
|
62
|
+
this.update();
|
63
|
+
|
64
|
+
if (this.options.showfirst) {
|
65
|
+
this.toggleItem(this.toggle.eq(0).data('wrapper'), false, false);
|
66
|
+
}
|
67
|
+
},
|
68
|
+
|
69
|
+
toggleItem: function(wrapper, animated, collapse) {
|
70
|
+
|
71
|
+
var $this = this;
|
72
|
+
|
73
|
+
wrapper.data('toggle').toggleClass(this.options.clsactive);
|
74
|
+
|
75
|
+
var active = wrapper.data('toggle').hasClass(this.options.clsactive);
|
76
|
+
|
77
|
+
if (collapse) {
|
78
|
+
this.toggle.not(wrapper.data('toggle')).removeClass(this.options.clsactive);
|
79
|
+
this.content.not(wrapper.data('content')).parent().stop().css('overflow', 'hidden').animate({ height: 0 }, {easing: this.options.easing, duration: animated ? this.options.duration : 0}).attr('aria-expanded', 'false');
|
80
|
+
}
|
81
|
+
|
82
|
+
wrapper.stop().css('overflow', 'hidden');
|
83
|
+
|
84
|
+
if (animated) {
|
85
|
+
|
86
|
+
wrapper.animate({ height: active ? getHeight(wrapper.data('content')) : 0 }, {easing: this.options.easing, duration: this.options.duration, complete: function() {
|
87
|
+
|
88
|
+
if (active) {
|
89
|
+
wrapper.css({'overflow': '', 'height': 'auto'});
|
90
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
91
|
+
}
|
92
|
+
|
93
|
+
$this.trigger('display.uk.check');
|
94
|
+
}});
|
95
|
+
|
96
|
+
} else {
|
97
|
+
|
98
|
+
wrapper.height(active ? 'auto' : 0);
|
99
|
+
|
100
|
+
if (active) {
|
101
|
+
wrapper.css({'overflow': ''});
|
102
|
+
UI.Utils.checkDisplay(wrapper.data('content'));
|
103
|
+
}
|
104
|
+
|
105
|
+
this.trigger('display.uk.check');
|
106
|
+
}
|
107
|
+
|
108
|
+
// Update ARIA
|
109
|
+
wrapper.attr('aria-expanded', active);
|
110
|
+
|
111
|
+
this.element.trigger('toggle.uk.accordion', [active, wrapper.data('toggle'), wrapper.data('content')]);
|
112
|
+
},
|
113
|
+
|
114
|
+
update: function() {
|
115
|
+
|
116
|
+
var $this = this, $content, $wrapper, $toggle;
|
117
|
+
|
118
|
+
this.toggle = this.find(this.options.toggle);
|
119
|
+
this.content = this.find(this.options.containers);
|
120
|
+
|
121
|
+
this.content.each(function(index) {
|
122
|
+
|
123
|
+
$content = UI.$(this);
|
124
|
+
|
125
|
+
if ($content.parent().data('wrapper')) {
|
126
|
+
$wrapper = $content.parent();
|
127
|
+
} else {
|
128
|
+
$wrapper = UI.$(this).wrap('<div data-wrapper="true" style="overflow:hidden;height:0;position:relative;"></div>').parent();
|
129
|
+
|
130
|
+
// Init ARIA
|
131
|
+
$wrapper.attr('aria-expanded', 'false');
|
132
|
+
}
|
133
|
+
|
134
|
+
$toggle = $this.toggle.eq(index);
|
135
|
+
|
136
|
+
$wrapper.data('toggle', $toggle);
|
137
|
+
$wrapper.data('content', $content);
|
138
|
+
$toggle.data('wrapper', $wrapper);
|
139
|
+
$content.data('wrapper', $wrapper);
|
140
|
+
});
|
141
|
+
|
142
|
+
this.element.trigger('update.uk.accordion', [this]);
|
143
|
+
}
|
144
|
+
|
145
|
+
});
|
146
|
+
|
147
|
+
// helper
|
148
|
+
|
149
|
+
function getHeight(ele) {
|
150
|
+
|
151
|
+
var $ele = UI.$(ele), height = "auto";
|
152
|
+
|
153
|
+
if ($ele.is(":visible")) {
|
154
|
+
height = $ele.outerHeight();
|
155
|
+
} else {
|
156
|
+
|
157
|
+
var tmp = {
|
158
|
+
position : $ele.css("position"),
|
159
|
+
visibility : $ele.css("visibility"),
|
160
|
+
display : $ele.css("display")
|
161
|
+
};
|
162
|
+
|
163
|
+
height = $ele.css({position: 'absolute', visibility: 'hidden', display: 'block'}).outerHeight();
|
164
|
+
|
165
|
+
$ele.css(tmp); // reset element
|
166
|
+
}
|
167
|
+
|
168
|
+
return height;
|
169
|
+
}
|
170
|
+
|
171
|
+
return UI.accordion;
|
172
|
+
});
|
@@ -1,19 +1,21 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
5
5
|
|
6
|
-
if (
|
7
|
-
component = addon(
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
8
|
}
|
9
9
|
|
10
10
|
if (typeof define == "function" && define.amd) {
|
11
11
|
define("uikit-autocomplete", ["uikit"], function(){
|
12
|
-
return component || addon(
|
12
|
+
return component || addon(UIkit);
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
})(function(
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
17
19
|
|
18
20
|
var active;
|
19
21
|
|
@@ -40,6 +42,24 @@
|
|
40
42
|
value : null,
|
41
43
|
selected : null,
|
42
44
|
|
45
|
+
boot: function() {
|
46
|
+
|
47
|
+
// init code
|
48
|
+
UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
|
49
|
+
|
50
|
+
var ele = UI.$(this);
|
51
|
+
|
52
|
+
if (!ele.data("autocomplete")) {
|
53
|
+
var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
|
54
|
+
}
|
55
|
+
});
|
56
|
+
|
57
|
+
// register outer click for autocompletes
|
58
|
+
UI.$html.on("click.autocomplete.uikit", function(e) {
|
59
|
+
if (active && e.target!=active.input[0]) active.hide();
|
60
|
+
});
|
61
|
+
},
|
62
|
+
|
43
63
|
init: function() {
|
44
64
|
|
45
65
|
var $this = this,
|
@@ -58,13 +78,15 @@
|
|
58
78
|
this.input = this.find("input:first").attr("autocomplete", "off");
|
59
79
|
|
60
80
|
if (!this.dropdown.length) {
|
61
|
-
this.dropdown =
|
81
|
+
this.dropdown = UI.$('<div class="uk-dropdown"></div>').appendTo(this.element);
|
62
82
|
}
|
63
83
|
|
64
84
|
if (this.options.flipDropdown) {
|
65
85
|
this.dropdown.addClass('uk-dropdown-flip');
|
66
86
|
}
|
67
87
|
|
88
|
+
this.dropdown.attr('aria-expanded', 'false');
|
89
|
+
|
68
90
|
this.input.on({
|
69
91
|
"keydown": function(e) {
|
70
92
|
|
@@ -105,7 +127,7 @@
|
|
105
127
|
});
|
106
128
|
|
107
129
|
this.dropdown.on("mouseover", ".uk-autocomplete-results > *", function(){
|
108
|
-
$this.pick(
|
130
|
+
$this.pick(UI.$(this));
|
109
131
|
});
|
110
132
|
|
111
133
|
this.triggercomplete = trigger;
|
@@ -129,7 +151,7 @@
|
|
129
151
|
pick: function(item, scrollinview) {
|
130
152
|
|
131
153
|
var $this = this,
|
132
|
-
items = this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')'),
|
154
|
+
items = UI.$(this.dropdown.find('.uk-autocomplete-results').children(':not(.'+this.options.skipClass+')')),
|
133
155
|
selected = false;
|
134
156
|
|
135
157
|
if (typeof item !== "string" && !item.hasClass(this.options.skipClass)) {
|
@@ -148,6 +170,8 @@
|
|
148
170
|
} else {
|
149
171
|
selected = items[(item == 'next') ? 'first' : 'last']();
|
150
172
|
}
|
173
|
+
|
174
|
+
selected = UI.$(selected);
|
151
175
|
}
|
152
176
|
|
153
177
|
if (selected && selected.length) {
|
@@ -175,10 +199,10 @@
|
|
175
199
|
|
176
200
|
var data = this.selected.data();
|
177
201
|
|
178
|
-
this.trigger("uk.autocomplete
|
202
|
+
this.trigger("selectitem.uk.autocomplete", [data, this]);
|
179
203
|
|
180
204
|
if (data.value) {
|
181
|
-
this.input.val(data.value);
|
205
|
+
this.input.val(data.value).trigger('change');
|
182
206
|
}
|
183
207
|
|
184
208
|
this.hide();
|
@@ -189,7 +213,15 @@
|
|
189
213
|
this.visible = true;
|
190
214
|
this.element.addClass("uk-open");
|
191
215
|
|
216
|
+
if (active && active!==this) {
|
217
|
+
active.hide();
|
218
|
+
}
|
219
|
+
|
192
220
|
active = this;
|
221
|
+
|
222
|
+
// Update aria
|
223
|
+
this.dropdown.attr('aria-expanded', 'true');
|
224
|
+
|
193
225
|
return this;
|
194
226
|
},
|
195
227
|
|
@@ -202,6 +234,9 @@
|
|
202
234
|
active = false;
|
203
235
|
}
|
204
236
|
|
237
|
+
// Update aria
|
238
|
+
this.dropdown.attr('aria-expanded', 'false');
|
239
|
+
|
205
240
|
return this;
|
206
241
|
},
|
207
242
|
|
@@ -253,7 +288,7 @@
|
|
253
288
|
|
254
289
|
params[this.options.param] = this.value;
|
255
290
|
|
256
|
-
|
291
|
+
UI.$.ajax({
|
257
292
|
url: this.options.source,
|
258
293
|
data: params,
|
259
294
|
type: this.options.method,
|
@@ -290,26 +325,12 @@
|
|
290
325
|
this.dropdown.append(this.template({"items":data}));
|
291
326
|
this.show();
|
292
327
|
|
293
|
-
this.trigger('uk.autocomplete
|
328
|
+
this.trigger('show.uk.autocomplete');
|
294
329
|
}
|
295
330
|
|
296
331
|
return this;
|
297
332
|
}
|
298
333
|
});
|
299
334
|
|
300
|
-
// init code
|
301
|
-
UI.$html.on("focus.autocomplete.uikit", "[data-uk-autocomplete]", function(e) {
|
302
|
-
|
303
|
-
var ele = $(this);
|
304
|
-
if (!ele.data("autocomplete")) {
|
305
|
-
var obj = UI.autocomplete(ele, UI.Utils.options(ele.attr("data-uk-autocomplete")));
|
306
|
-
}
|
307
|
-
});
|
308
|
-
|
309
|
-
// register outer click for autocompletes
|
310
|
-
UI.$html.on("click.autocomplete.uikit", function(e){
|
311
|
-
if (active && e.target!=active.input[0]) active.hide();
|
312
|
-
});
|
313
|
-
|
314
335
|
return UI.autocomplete;
|
315
|
-
});
|
336
|
+
});
|
@@ -1,19 +1,21 @@
|
|
1
|
-
/*! UIkit 2.
|
1
|
+
/*! UIkit 2.20.3 | http://www.getuikit.com | (c) 2014 YOOtheme | MIT License */
|
2
2
|
(function(addon) {
|
3
3
|
|
4
4
|
var component;
|
5
5
|
|
6
|
-
if (
|
7
|
-
component = addon(
|
6
|
+
if (window.UIkit) {
|
7
|
+
component = addon(UIkit);
|
8
8
|
}
|
9
9
|
|
10
10
|
if (typeof define == "function" && define.amd) {
|
11
11
|
define("uikit-datepicker", ["uikit"], function(){
|
12
|
-
return component || addon(
|
12
|
+
return component || addon(UIkit);
|
13
13
|
});
|
14
14
|
}
|
15
15
|
|
16
|
-
})(function(
|
16
|
+
})(function(UI){
|
17
|
+
|
18
|
+
"use strict";
|
17
19
|
|
18
20
|
// Datepicker
|
19
21
|
|
@@ -22,6 +24,7 @@
|
|
22
24
|
UI.component('datepicker', {
|
23
25
|
|
24
26
|
defaults: {
|
27
|
+
mobile: false,
|
25
28
|
weekstart: 1,
|
26
29
|
i18n: {
|
27
30
|
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
@@ -31,16 +34,17 @@
|
|
31
34
|
offsettop: 5,
|
32
35
|
maxDate: false,
|
33
36
|
minDate: false,
|
37
|
+
pos: 'auto',
|
34
38
|
template: function(data, opts) {
|
35
39
|
|
36
|
-
var content = '', maxDate, minDate;
|
40
|
+
var content = '', maxDate, minDate, i;
|
37
41
|
|
38
42
|
if (opts.maxDate!==false){
|
39
|
-
maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add('days'
|
43
|
+
maxDate = isNaN(opts.maxDate) ? moment(opts.maxDate, opts.format) : moment().add(opts.maxDate, 'days');
|
40
44
|
}
|
41
45
|
|
42
46
|
if (opts.minDate!==false){
|
43
|
-
minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add(
|
47
|
+
minDate = isNaN(opts.minDate) ? moment(opts.minDate, opts.format) : moment().add(opts.minDate-1, 'days');
|
44
48
|
}
|
45
49
|
|
46
50
|
content += '<div class="uk-datepicker-nav">';
|
@@ -49,7 +53,7 @@
|
|
49
53
|
|
50
54
|
if (UI.formSelect) {
|
51
55
|
|
52
|
-
var
|
56
|
+
var currentyear = (new Date()).getFullYear(), options = [], months, years, minYear, maxYear;
|
53
57
|
|
54
58
|
for (i=0;i<opts.i18n.months.length;i++) {
|
55
59
|
if(i==data.month) {
|
@@ -88,7 +92,7 @@
|
|
88
92
|
|
89
93
|
content += '<table class="uk-datepicker-table">';
|
90
94
|
content += '<thead>';
|
91
|
-
for(
|
95
|
+
for(i = 0; i < data.weekdays.length; i++) {
|
92
96
|
if (data.weekdays[i]) {
|
93
97
|
content += '<th>'+data.weekdays[i]+'</th>';
|
94
98
|
}
|
@@ -96,7 +100,7 @@
|
|
96
100
|
content += '</thead>';
|
97
101
|
|
98
102
|
content += '<tbody>';
|
99
|
-
for(
|
103
|
+
for(i = 0; i < data.days.length; i++) {
|
100
104
|
if (data.days[i] && data.days[i].length){
|
101
105
|
content += '<tr>';
|
102
106
|
for(var d = 0; d < data.days[i].length; d++) {
|
@@ -124,47 +128,83 @@
|
|
124
128
|
}
|
125
129
|
},
|
126
130
|
|
131
|
+
boot: function() {
|
132
|
+
|
133
|
+
UI.$win.on("resize orientationchange", function() {
|
134
|
+
|
135
|
+
if (active) {
|
136
|
+
active.hide();
|
137
|
+
}
|
138
|
+
});
|
139
|
+
|
140
|
+
// init code
|
141
|
+
UI.$html.on("focus.datepicker.uikit", "[data-uk-datepicker]", function(e) {
|
142
|
+
|
143
|
+
var ele = UI.$(this);
|
144
|
+
|
145
|
+
if (!ele.data("datepicker")) {
|
146
|
+
e.preventDefault();
|
147
|
+
var obj = UI.datepicker(ele, UI.Utils.options(ele.attr("data-uk-datepicker")));
|
148
|
+
ele.trigger("focus");
|
149
|
+
}
|
150
|
+
});
|
151
|
+
|
152
|
+
UI.$html.on("click.datepicker.uikit", function(e) {
|
153
|
+
|
154
|
+
var target = UI.$(e.target);
|
155
|
+
|
156
|
+
if (active && target[0] != dropdown[0] && !target.data("datepicker") && !target.parents(".uk-datepicker:first").length) {
|
157
|
+
active.hide();
|
158
|
+
}
|
159
|
+
});
|
160
|
+
},
|
161
|
+
|
127
162
|
init: function() {
|
128
163
|
|
164
|
+
// use native datepicker on touch devices
|
165
|
+
if (UI.support.touch && this.element.attr('type')=='date' && !this.options.mobile) {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
|
129
169
|
var $this = this;
|
130
170
|
|
131
171
|
this.current = this.element.val() ? moment(this.element.val(), this.options.format) : moment();
|
132
172
|
|
133
|
-
this.on("click", function(){
|
134
|
-
if(active!==$this) $this.pick(this.value);
|
173
|
+
this.on("click focus", function(){
|
174
|
+
if (active!==$this) $this.pick(this.value ? this.value:($this.options.minDate ? $this.options.minDate :''));
|
135
175
|
}).on("change", function(){
|
136
176
|
|
137
|
-
if($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
|
177
|
+
if ($this.element.val() && !moment($this.element.val(), $this.options.format).isValid()) {
|
138
178
|
$this.element.val(moment().format($this.options.format));
|
139
179
|
}
|
140
|
-
|
141
180
|
});
|
142
181
|
|
143
182
|
// init dropdown
|
144
183
|
if (!dropdown) {
|
145
184
|
|
146
|
-
dropdown =
|
185
|
+
dropdown = UI.$('<div class="uk-dropdown uk-datepicker"></div>');
|
147
186
|
|
148
187
|
dropdown.on("click", ".uk-datepicker-next, .uk-datepicker-previous, [data-date]", function(e){
|
188
|
+
|
149
189
|
e.stopPropagation();
|
150
190
|
e.preventDefault();
|
151
191
|
|
152
|
-
var ele =
|
192
|
+
var ele = UI.$(this);
|
153
193
|
|
154
194
|
if (ele.hasClass('uk-datepicker-date-disabled')) return false;
|
155
195
|
|
156
|
-
if(ele.is('[data-date]')) {
|
196
|
+
if (ele.is('[data-date]')) {
|
157
197
|
active.element.val(moment(ele.data("date")).format(active.options.format)).trigger("change");
|
158
198
|
dropdown.hide();
|
159
199
|
active = false;
|
160
200
|
} else {
|
161
|
-
active.add(
|
201
|
+
active.add(1 * (ele.hasClass("uk-datepicker-next") ? 1:-1), "months");
|
162
202
|
}
|
163
203
|
});
|
164
204
|
|
165
205
|
dropdown.on('change', '.update-picker-month, .update-picker-year', function(){
|
166
206
|
|
167
|
-
var select =
|
207
|
+
var select = UI.$(this);
|
168
208
|
active[select.is('.update-picker-year') ? 'setYear':'setMonth'](Number(select.val()));
|
169
209
|
});
|
170
210
|
|
@@ -175,19 +215,31 @@
|
|
175
215
|
pick: function(initdate) {
|
176
216
|
|
177
217
|
var offset = this.element.offset(),
|
178
|
-
css = {"
|
218
|
+
css = {"left": offset.left, "right":""};
|
179
219
|
|
180
220
|
this.current = initdate ? moment(initdate, this.options.format):moment();
|
181
221
|
this.initdate = this.current.format("YYYY-MM-DD");
|
182
222
|
|
183
223
|
this.update();
|
184
224
|
|
185
|
-
if (
|
225
|
+
if (UI.langdirection == 'right') {
|
186
226
|
css.right = window.innerWidth - (css.left + this.element.outerWidth());
|
187
227
|
css.left = "";
|
188
228
|
}
|
189
229
|
|
230
|
+
var posTop = (offset.top - this.element.outerHeight() + this.element.height()) - this.options.offsettop - dropdown.outerHeight(),
|
231
|
+
posBottom = offset.top + this.element.outerHeight() + this.options.offsettop;
|
232
|
+
|
233
|
+
css.top = posBottom;
|
234
|
+
|
235
|
+
if (this.options.pos == 'top') {
|
236
|
+
css.top = posTop;
|
237
|
+
} else if(this.options.pos == 'auto' && (window.innerHeight - posBottom - dropdown.outerHeight() < 0 && posTop >= 0) ) {
|
238
|
+
css.top = posTop;
|
239
|
+
}
|
240
|
+
|
190
241
|
dropdown.css(css).show();
|
242
|
+
this.trigger('show.uk.datepicker');
|
191
243
|
|
192
244
|
active = this;
|
193
245
|
},
|
@@ -213,6 +265,8 @@
|
|
213
265
|
tpl = this.options.template(data, this.options);
|
214
266
|
|
215
267
|
dropdown.html(tpl);
|
268
|
+
|
269
|
+
this.trigger('update.uk.datepicker');
|
216
270
|
},
|
217
271
|
|
218
272
|
getRows: function(year, month) {
|
@@ -283,96 +337,2832 @@
|
|
283
337
|
if (active && active === this) {
|
284
338
|
dropdown.hide();
|
285
339
|
active = false;
|
340
|
+
|
341
|
+
this.trigger('hide.uk.datepicker');
|
286
342
|
}
|
287
343
|
}
|
288
344
|
});
|
289
345
|
|
290
|
-
|
346
|
+
//! moment.js
|
347
|
+
//! version : 2.8.3
|
348
|
+
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors
|
349
|
+
//! license : MIT
|
350
|
+
//! momentjs.com
|
351
|
+
|
352
|
+
moment = (function (undefined) {
|
353
|
+
/************************************
|
354
|
+
Constants
|
355
|
+
************************************/
|
356
|
+
var moment,
|
357
|
+
VERSION = '2.8.3',
|
358
|
+
// the global-scope this is NOT the global object in Node.js
|
359
|
+
globalScope = typeof global !== 'undefined' ? global : this,
|
360
|
+
oldGlobalMoment,
|
361
|
+
round = Math.round,
|
362
|
+
hasOwnProperty = Object.prototype.hasOwnProperty,
|
363
|
+
i,
|
364
|
+
|
365
|
+
YEAR = 0,
|
366
|
+
MONTH = 1,
|
367
|
+
DATE = 2,
|
368
|
+
HOUR = 3,
|
369
|
+
MINUTE = 4,
|
370
|
+
SECOND = 5,
|
371
|
+
MILLISECOND = 6,
|
372
|
+
|
373
|
+
// internal storage for locale config files
|
374
|
+
locales = {},
|
375
|
+
|
376
|
+
// extra moment internal properties (plugins register props here)
|
377
|
+
momentProperties = [],
|
378
|
+
|
379
|
+
// check for nodeJS
|
380
|
+
hasModule = (typeof module !== 'undefined' && module.exports),
|
381
|
+
|
382
|
+
// ASP.NET json date format regex
|
383
|
+
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
|
384
|
+
aspNetTimeSpanJsonRegex = /(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,
|
385
|
+
|
386
|
+
// from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
|
387
|
+
// somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
|
388
|
+
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
|
389
|
+
|
390
|
+
// format tokens
|
391
|
+
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
|
392
|
+
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
|
393
|
+
|
394
|
+
// parsing token regexes
|
395
|
+
parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
|
396
|
+
parseTokenOneToThreeDigits = /\d{1,3}/, // 0 - 999
|
397
|
+
parseTokenOneToFourDigits = /\d{1,4}/, // 0 - 9999
|
398
|
+
parseTokenOneToSixDigits = /[+\-]?\d{1,6}/, // -999,999 - 999,999
|
399
|
+
parseTokenDigits = /\d+/, // nonzero number of digits
|
400
|
+
parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
|
401
|
+
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
|
402
|
+
parseTokenT = /T/i, // T (ISO separator)
|
403
|
+
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
|
404
|
+
parseTokenOrdinal = /\d{1,2}/,
|
405
|
+
|
406
|
+
//strict parsing regexes
|
407
|
+
parseTokenOneDigit = /\d/, // 0 - 9
|
408
|
+
parseTokenTwoDigits = /\d\d/, // 00 - 99
|
409
|
+
parseTokenThreeDigits = /\d{3}/, // 000 - 999
|
410
|
+
parseTokenFourDigits = /\d{4}/, // 0000 - 9999
|
411
|
+
parseTokenSixDigits = /[+-]?\d{6}/, // -999,999 - 999,999
|
412
|
+
parseTokenSignedNumber = /[+-]?\d+/, // -inf - inf
|
413
|
+
|
414
|
+
// iso 8601 regex
|
415
|
+
// 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
|
416
|
+
isoRegex = /^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
|
417
|
+
|
418
|
+
isoFormat = 'YYYY-MM-DDTHH:mm:ssZ',
|
419
|
+
|
420
|
+
isoDates = [
|
421
|
+
['YYYYYY-MM-DD', /[+-]\d{6}-\d{2}-\d{2}/],
|
422
|
+
['YYYY-MM-DD', /\d{4}-\d{2}-\d{2}/],
|
423
|
+
['GGGG-[W]WW-E', /\d{4}-W\d{2}-\d/],
|
424
|
+
['GGGG-[W]WW', /\d{4}-W\d{2}/],
|
425
|
+
['YYYY-DDD', /\d{4}-\d{3}/]
|
426
|
+
],
|
427
|
+
|
428
|
+
// iso time formats and regexes
|
429
|
+
isoTimes = [
|
430
|
+
['HH:mm:ss.SSSS', /(T| )\d\d:\d\d:\d\d\.\d+/],
|
431
|
+
['HH:mm:ss', /(T| )\d\d:\d\d:\d\d/],
|
432
|
+
['HH:mm', /(T| )\d\d:\d\d/],
|
433
|
+
['HH', /(T| )\d\d/]
|
434
|
+
],
|
435
|
+
|
436
|
+
// timezone chunker '+10:00' > ['10', '00'] or '-1530' > ['-15', '30']
|
437
|
+
parseTimezoneChunker = /([\+\-]|\d\d)/gi,
|
438
|
+
|
439
|
+
// getter and setter names
|
440
|
+
proxyGettersAndSetters = 'Date|Hours|Minutes|Seconds|Milliseconds'.split('|'),
|
441
|
+
unitMillisecondFactors = {
|
442
|
+
'Milliseconds' : 1,
|
443
|
+
'Seconds' : 1e3,
|
444
|
+
'Minutes' : 6e4,
|
445
|
+
'Hours' : 36e5,
|
446
|
+
'Days' : 864e5,
|
447
|
+
'Months' : 2592e6,
|
448
|
+
'Years' : 31536e6
|
449
|
+
},
|
450
|
+
|
451
|
+
unitAliases = {
|
452
|
+
ms : 'millisecond',
|
453
|
+
s : 'second',
|
454
|
+
m : 'minute',
|
455
|
+
h : 'hour',
|
456
|
+
d : 'day',
|
457
|
+
D : 'date',
|
458
|
+
w : 'week',
|
459
|
+
W : 'isoWeek',
|
460
|
+
M : 'month',
|
461
|
+
Q : 'quarter',
|
462
|
+
y : 'year',
|
463
|
+
DDD : 'dayOfYear',
|
464
|
+
e : 'weekday',
|
465
|
+
E : 'isoWeekday',
|
466
|
+
gg: 'weekYear',
|
467
|
+
GG: 'isoWeekYear'
|
468
|
+
},
|
469
|
+
|
470
|
+
camelFunctions = {
|
471
|
+
dayofyear : 'dayOfYear',
|
472
|
+
isoweekday : 'isoWeekday',
|
473
|
+
isoweek : 'isoWeek',
|
474
|
+
weekyear : 'weekYear',
|
475
|
+
isoweekyear : 'isoWeekYear'
|
476
|
+
},
|
477
|
+
|
478
|
+
// format function strings
|
479
|
+
formatFunctions = {},
|
480
|
+
|
481
|
+
// default relative time thresholds
|
482
|
+
relativeTimeThresholds = {
|
483
|
+
s: 45, // seconds to minute
|
484
|
+
m: 45, // minutes to hour
|
485
|
+
h: 22, // hours to day
|
486
|
+
d: 26, // days to month
|
487
|
+
M: 11 // months to year
|
488
|
+
},
|
489
|
+
|
490
|
+
// tokens to ordinalize and pad
|
491
|
+
ordinalizeTokens = 'DDD w W M D d'.split(' '),
|
492
|
+
paddedTokens = 'M D H h m s w W'.split(' '),
|
493
|
+
|
494
|
+
formatTokenFunctions = {
|
495
|
+
M : function () {
|
496
|
+
return this.month() + 1;
|
497
|
+
},
|
498
|
+
MMM : function (format) {
|
499
|
+
return this.localeData().monthsShort(this, format);
|
500
|
+
},
|
501
|
+
MMMM : function (format) {
|
502
|
+
return this.localeData().months(this, format);
|
503
|
+
},
|
504
|
+
D : function () {
|
505
|
+
return this.date();
|
506
|
+
},
|
507
|
+
DDD : function () {
|
508
|
+
return this.dayOfYear();
|
509
|
+
},
|
510
|
+
d : function () {
|
511
|
+
return this.day();
|
512
|
+
},
|
513
|
+
dd : function (format) {
|
514
|
+
return this.localeData().weekdaysMin(this, format);
|
515
|
+
},
|
516
|
+
ddd : function (format) {
|
517
|
+
return this.localeData().weekdaysShort(this, format);
|
518
|
+
},
|
519
|
+
dddd : function (format) {
|
520
|
+
return this.localeData().weekdays(this, format);
|
521
|
+
},
|
522
|
+
w : function () {
|
523
|
+
return this.week();
|
524
|
+
},
|
525
|
+
W : function () {
|
526
|
+
return this.isoWeek();
|
527
|
+
},
|
528
|
+
YY : function () {
|
529
|
+
return leftZeroFill(this.year() % 100, 2);
|
530
|
+
},
|
531
|
+
YYYY : function () {
|
532
|
+
return leftZeroFill(this.year(), 4);
|
533
|
+
},
|
534
|
+
YYYYY : function () {
|
535
|
+
return leftZeroFill(this.year(), 5);
|
536
|
+
},
|
537
|
+
YYYYYY : function () {
|
538
|
+
var y = this.year(), sign = y >= 0 ? '+' : '-';
|
539
|
+
return sign + leftZeroFill(Math.abs(y), 6);
|
540
|
+
},
|
541
|
+
gg : function () {
|
542
|
+
return leftZeroFill(this.weekYear() % 100, 2);
|
543
|
+
},
|
544
|
+
gggg : function () {
|
545
|
+
return leftZeroFill(this.weekYear(), 4);
|
546
|
+
},
|
547
|
+
ggggg : function () {
|
548
|
+
return leftZeroFill(this.weekYear(), 5);
|
549
|
+
},
|
550
|
+
GG : function () {
|
551
|
+
return leftZeroFill(this.isoWeekYear() % 100, 2);
|
552
|
+
},
|
553
|
+
GGGG : function () {
|
554
|
+
return leftZeroFill(this.isoWeekYear(), 4);
|
555
|
+
},
|
556
|
+
GGGGG : function () {
|
557
|
+
return leftZeroFill(this.isoWeekYear(), 5);
|
558
|
+
},
|
559
|
+
e : function () {
|
560
|
+
return this.weekday();
|
561
|
+
},
|
562
|
+
E : function () {
|
563
|
+
return this.isoWeekday();
|
564
|
+
},
|
565
|
+
a : function () {
|
566
|
+
return this.localeData().meridiem(this.hours(), this.minutes(), true);
|
567
|
+
},
|
568
|
+
A : function () {
|
569
|
+
return this.localeData().meridiem(this.hours(), this.minutes(), false);
|
570
|
+
},
|
571
|
+
H : function () {
|
572
|
+
return this.hours();
|
573
|
+
},
|
574
|
+
h : function () {
|
575
|
+
return this.hours() % 12 || 12;
|
576
|
+
},
|
577
|
+
m : function () {
|
578
|
+
return this.minutes();
|
579
|
+
},
|
580
|
+
s : function () {
|
581
|
+
return this.seconds();
|
582
|
+
},
|
583
|
+
S : function () {
|
584
|
+
return toInt(this.milliseconds() / 100);
|
585
|
+
},
|
586
|
+
SS : function () {
|
587
|
+
return leftZeroFill(toInt(this.milliseconds() / 10), 2);
|
588
|
+
},
|
589
|
+
SSS : function () {
|
590
|
+
return leftZeroFill(this.milliseconds(), 3);
|
591
|
+
},
|
592
|
+
SSSS : function () {
|
593
|
+
return leftZeroFill(this.milliseconds(), 3);
|
594
|
+
},
|
595
|
+
Z : function () {
|
596
|
+
var a = -this.zone(),
|
597
|
+
b = '+';
|
598
|
+
if (a < 0) {
|
599
|
+
a = -a;
|
600
|
+
b = '-';
|
601
|
+
}
|
602
|
+
return b + leftZeroFill(toInt(a / 60), 2) + ':' + leftZeroFill(toInt(a) % 60, 2);
|
603
|
+
},
|
604
|
+
ZZ : function () {
|
605
|
+
var a = -this.zone(),
|
606
|
+
b = '+';
|
607
|
+
if (a < 0) {
|
608
|
+
a = -a;
|
609
|
+
b = '-';
|
610
|
+
}
|
611
|
+
return b + leftZeroFill(toInt(a / 60), 2) + leftZeroFill(toInt(a) % 60, 2);
|
612
|
+
},
|
613
|
+
z : function () {
|
614
|
+
return this.zoneAbbr();
|
615
|
+
},
|
616
|
+
zz : function () {
|
617
|
+
return this.zoneName();
|
618
|
+
},
|
619
|
+
X : function () {
|
620
|
+
return this.unix();
|
621
|
+
},
|
622
|
+
Q : function () {
|
623
|
+
return this.quarter();
|
624
|
+
}
|
625
|
+
},
|
626
|
+
|
627
|
+
deprecations = {},
|
628
|
+
|
629
|
+
lists = ['months', 'monthsShort', 'weekdays', 'weekdaysShort', 'weekdaysMin'];
|
291
630
|
|
292
|
-
|
293
|
-
|
631
|
+
// Pick the first defined of two or three arguments. dfl comes from
|
632
|
+
// default.
|
633
|
+
function dfl(a, b, c) {
|
634
|
+
switch (arguments.length) {
|
635
|
+
case 2: return a != null ? a : b;
|
636
|
+
case 3: return a != null ? a : b != null ? b : c;
|
637
|
+
default: throw new Error('Implement me');
|
638
|
+
}
|
294
639
|
}
|
295
|
-
});
|
296
640
|
|
641
|
+
function hasOwnProp(a, b) {
|
642
|
+
return hasOwnProperty.call(a, b);
|
643
|
+
}
|
297
644
|
|
298
|
-
|
299
|
-
|
645
|
+
function defaultParsingFlags() {
|
646
|
+
// We need to deep clone this object, and es5 standard is not very
|
647
|
+
// helpful.
|
648
|
+
return {
|
649
|
+
empty : false,
|
650
|
+
unusedTokens : [],
|
651
|
+
unusedInput : [],
|
652
|
+
overflow : -2,
|
653
|
+
charsLeftOver : 0,
|
654
|
+
nullInput : false,
|
655
|
+
invalidMonth : null,
|
656
|
+
invalidFormat : false,
|
657
|
+
userInvalidated : false,
|
658
|
+
iso: false
|
659
|
+
};
|
660
|
+
}
|
300
661
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
662
|
+
function printMsg(msg) {
|
663
|
+
if (moment.suppressDeprecationWarnings === false &&
|
664
|
+
typeof console !== 'undefined' && console.warn) {
|
665
|
+
console.warn('Deprecation warning: ' + msg);
|
666
|
+
}
|
306
667
|
}
|
307
|
-
});
|
308
668
|
|
309
|
-
|
669
|
+
function deprecate(msg, fn) {
|
670
|
+
var firstTime = true;
|
671
|
+
return extend(function () {
|
672
|
+
if (firstTime) {
|
673
|
+
printMsg(msg);
|
674
|
+
firstTime = false;
|
675
|
+
}
|
676
|
+
return fn.apply(this, arguments);
|
677
|
+
}, fn);
|
678
|
+
}
|
310
679
|
|
311
|
-
|
680
|
+
function deprecateSimple(name, msg) {
|
681
|
+
if (!deprecations[name]) {
|
682
|
+
printMsg(msg);
|
683
|
+
deprecations[name] = true;
|
684
|
+
}
|
685
|
+
}
|
312
686
|
|
313
|
-
|
314
|
-
|
687
|
+
function padToken(func, count) {
|
688
|
+
return function (a) {
|
689
|
+
return leftZeroFill(func.call(this, a), count);
|
690
|
+
};
|
691
|
+
}
|
692
|
+
function ordinalizeToken(func, period) {
|
693
|
+
return function (a) {
|
694
|
+
return this.localeData().ordinal(func.call(this, a), period);
|
695
|
+
};
|
315
696
|
}
|
316
|
-
});
|
317
697
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
698
|
+
while (ordinalizeTokens.length) {
|
699
|
+
i = ordinalizeTokens.pop();
|
700
|
+
formatTokenFunctions[i + 'o'] = ordinalizeToken(formatTokenFunctions[i], i);
|
701
|
+
}
|
702
|
+
while (paddedTokens.length) {
|
703
|
+
i = paddedTokens.pop();
|
704
|
+
formatTokenFunctions[i + i] = padToken(formatTokenFunctions[i], 2);
|
705
|
+
}
|
706
|
+
formatTokenFunctions.DDDD = padToken(formatTokenFunctions.DDD, 3);
|
707
|
+
|
708
|
+
|
709
|
+
/************************************
|
710
|
+
Constructors
|
711
|
+
************************************/
|
712
|
+
|
713
|
+
function Locale() {
|
714
|
+
}
|
715
|
+
|
716
|
+
// Moment prototype object
|
717
|
+
function Moment(config, skipOverflow) {
|
718
|
+
if (skipOverflow !== false) {
|
719
|
+
checkOverflow(config);
|
720
|
+
}
|
721
|
+
copyConfig(this, config);
|
722
|
+
this._d = new Date(+config._d);
|
723
|
+
}
|
724
|
+
|
725
|
+
// Duration Constructor
|
726
|
+
function Duration(duration) {
|
727
|
+
var normalizedInput = normalizeObjectUnits(duration),
|
728
|
+
years = normalizedInput.year || 0,
|
729
|
+
quarters = normalizedInput.quarter || 0,
|
730
|
+
months = normalizedInput.month || 0,
|
731
|
+
weeks = normalizedInput.week || 0,
|
732
|
+
days = normalizedInput.day || 0,
|
733
|
+
hours = normalizedInput.hour || 0,
|
734
|
+
minutes = normalizedInput.minute || 0,
|
735
|
+
seconds = normalizedInput.second || 0,
|
736
|
+
milliseconds = normalizedInput.millisecond || 0;
|
737
|
+
|
738
|
+
// representation for dateAddRemove
|
739
|
+
this._milliseconds = +milliseconds +
|
740
|
+
seconds * 1e3 + // 1000
|
741
|
+
minutes * 6e4 + // 1000 * 60
|
742
|
+
hours * 36e5; // 1000 * 60 * 60
|
743
|
+
// Because of dateAddRemove treats 24 hours as different from a
|
744
|
+
// day when working around DST, we need to store them separately
|
745
|
+
this._days = +days +
|
746
|
+
weeks * 7;
|
747
|
+
// It is impossible translate months into days without knowing
|
748
|
+
// which months you are are talking about, so we have to store
|
749
|
+
// it separately.
|
750
|
+
this._months = +months +
|
751
|
+
quarters * 3 +
|
752
|
+
years * 12;
|
753
|
+
|
754
|
+
this._data = {};
|
755
|
+
|
756
|
+
this._locale = moment.localeData();
|
757
|
+
|
758
|
+
this._bubble();
|
759
|
+
}
|
760
|
+
|
761
|
+
/************************************
|
762
|
+
Helpers
|
763
|
+
************************************/
|
764
|
+
|
765
|
+
|
766
|
+
function extend(a, b) {
|
767
|
+
for (var i in b) {
|
768
|
+
if (hasOwnProp(b, i)) {
|
769
|
+
a[i] = b[i];
|
770
|
+
}
|
771
|
+
}
|
772
|
+
|
773
|
+
if (hasOwnProp(b, 'toString')) {
|
774
|
+
a.toString = b.toString;
|
775
|
+
}
|
776
|
+
|
777
|
+
if (hasOwnProp(b, 'valueOf')) {
|
778
|
+
a.valueOf = b.valueOf;
|
779
|
+
}
|
780
|
+
|
781
|
+
return a;
|
782
|
+
}
|
783
|
+
|
784
|
+
function copyConfig(to, from) {
|
785
|
+
var i, prop, val;
|
786
|
+
|
787
|
+
if (typeof from._isAMomentObject !== 'undefined') {
|
788
|
+
to._isAMomentObject = from._isAMomentObject;
|
789
|
+
}
|
790
|
+
if (typeof from._i !== 'undefined') {
|
791
|
+
to._i = from._i;
|
792
|
+
}
|
793
|
+
if (typeof from._f !== 'undefined') {
|
794
|
+
to._f = from._f;
|
795
|
+
}
|
796
|
+
if (typeof from._l !== 'undefined') {
|
797
|
+
to._l = from._l;
|
798
|
+
}
|
799
|
+
if (typeof from._strict !== 'undefined') {
|
800
|
+
to._strict = from._strict;
|
801
|
+
}
|
802
|
+
if (typeof from._tzm !== 'undefined') {
|
803
|
+
to._tzm = from._tzm;
|
804
|
+
}
|
805
|
+
if (typeof from._isUTC !== 'undefined') {
|
806
|
+
to._isUTC = from._isUTC;
|
807
|
+
}
|
808
|
+
if (typeof from._offset !== 'undefined') {
|
809
|
+
to._offset = from._offset;
|
810
|
+
}
|
811
|
+
if (typeof from._pf !== 'undefined') {
|
812
|
+
to._pf = from._pf;
|
813
|
+
}
|
814
|
+
if (typeof from._locale !== 'undefined') {
|
815
|
+
to._locale = from._locale;
|
816
|
+
}
|
817
|
+
|
818
|
+
if (momentProperties.length > 0) {
|
819
|
+
for (i in momentProperties) {
|
820
|
+
prop = momentProperties[i];
|
821
|
+
val = from[prop];
|
822
|
+
if (typeof val !== 'undefined') {
|
823
|
+
to[prop] = val;
|
824
|
+
}
|
825
|
+
}
|
826
|
+
}
|
827
|
+
|
828
|
+
return to;
|
829
|
+
}
|
830
|
+
|
831
|
+
function absRound(number) {
|
832
|
+
if (number < 0) {
|
833
|
+
return Math.ceil(number);
|
834
|
+
} else {
|
835
|
+
return Math.floor(number);
|
836
|
+
}
|
837
|
+
}
|
838
|
+
|
839
|
+
// left zero fill a number
|
840
|
+
// see http://jsperf.com/left-zero-filling for performance comparison
|
841
|
+
function leftZeroFill(number, targetLength, forceSign) {
|
842
|
+
var output = '' + Math.abs(number),
|
843
|
+
sign = number >= 0;
|
844
|
+
|
845
|
+
while (output.length < targetLength) {
|
846
|
+
output = '0' + output;
|
847
|
+
}
|
848
|
+
return (sign ? (forceSign ? '+' : '') : '-') + output;
|
849
|
+
}
|
850
|
+
|
851
|
+
function positiveMomentsDifference(base, other) {
|
852
|
+
var res = {milliseconds: 0, months: 0};
|
853
|
+
|
854
|
+
res.months = other.month() - base.month() +
|
855
|
+
(other.year() - base.year()) * 12;
|
856
|
+
if (base.clone().add(res.months, 'M').isAfter(other)) {
|
857
|
+
--res.months;
|
858
|
+
}
|
859
|
+
|
860
|
+
res.milliseconds = +other - +(base.clone().add(res.months, 'M'));
|
861
|
+
|
862
|
+
return res;
|
863
|
+
}
|
864
|
+
|
865
|
+
function momentsDifference(base, other) {
|
866
|
+
var res;
|
867
|
+
other = makeAs(other, base);
|
868
|
+
if (base.isBefore(other)) {
|
869
|
+
res = positiveMomentsDifference(base, other);
|
870
|
+
} else {
|
871
|
+
res = positiveMomentsDifference(other, base);
|
872
|
+
res.milliseconds = -res.milliseconds;
|
873
|
+
res.months = -res.months;
|
874
|
+
}
|
875
|
+
|
876
|
+
return res;
|
877
|
+
}
|
878
|
+
|
879
|
+
// TODO: remove 'name' arg after deprecation is removed
|
880
|
+
function createAdder(direction, name) {
|
881
|
+
return function (val, period) {
|
882
|
+
var dur, tmp;
|
883
|
+
//invert the arguments, but complain about it
|
884
|
+
if (period !== null && !isNaN(+period)) {
|
885
|
+
deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period).');
|
886
|
+
tmp = val; val = period; period = tmp;
|
887
|
+
}
|
888
|
+
|
889
|
+
val = typeof val === 'string' ? +val : val;
|
890
|
+
dur = moment.duration(val, period);
|
891
|
+
addOrSubtractDurationFromMoment(this, dur, direction);
|
892
|
+
return this;
|
893
|
+
};
|
894
|
+
}
|
895
|
+
|
896
|
+
function addOrSubtractDurationFromMoment(mom, duration, isAdding, updateOffset) {
|
897
|
+
var milliseconds = duration._milliseconds,
|
898
|
+
days = duration._days,
|
899
|
+
months = duration._months;
|
900
|
+
updateOffset = updateOffset == null ? true : updateOffset;
|
901
|
+
|
902
|
+
if (milliseconds) {
|
903
|
+
mom._d.setTime(+mom._d + milliseconds * isAdding);
|
904
|
+
}
|
905
|
+
if (days) {
|
906
|
+
rawSetter(mom, 'Date', rawGetter(mom, 'Date') + days * isAdding);
|
907
|
+
}
|
908
|
+
if (months) {
|
909
|
+
rawMonthSetter(mom, rawGetter(mom, 'Month') + months * isAdding);
|
910
|
+
}
|
911
|
+
if (updateOffset) {
|
912
|
+
moment.updateOffset(mom, days || months);
|
913
|
+
}
|
914
|
+
}
|
915
|
+
|
916
|
+
// check if is an array
|
917
|
+
function isArray(input) {
|
918
|
+
return Object.prototype.toString.call(input) === '[object Array]';
|
919
|
+
}
|
920
|
+
|
921
|
+
function isDate(input) {
|
922
|
+
return Object.prototype.toString.call(input) === '[object Date]' ||
|
923
|
+
input instanceof Date;
|
924
|
+
}
|
925
|
+
|
926
|
+
// compare two arrays, return the number of differences
|
927
|
+
function compareArrays(array1, array2, dontConvert) {
|
928
|
+
var len = Math.min(array1.length, array2.length),
|
929
|
+
lengthDiff = Math.abs(array1.length - array2.length),
|
930
|
+
diffs = 0,
|
931
|
+
i;
|
932
|
+
for (i = 0; i < len; i++) {
|
933
|
+
if ((dontConvert && array1[i] !== array2[i]) ||
|
934
|
+
(!dontConvert && toInt(array1[i]) !== toInt(array2[i]))) {
|
935
|
+
diffs++;
|
936
|
+
}
|
937
|
+
}
|
938
|
+
return diffs + lengthDiff;
|
939
|
+
}
|
940
|
+
|
941
|
+
function normalizeUnits(units) {
|
942
|
+
if (units) {
|
943
|
+
var lowered = units.toLowerCase().replace(/(.)s$/, '$1');
|
944
|
+
units = unitAliases[units] || camelFunctions[lowered] || lowered;
|
945
|
+
}
|
946
|
+
return units;
|
947
|
+
}
|
948
|
+
|
949
|
+
function normalizeObjectUnits(inputObject) {
|
950
|
+
var normalizedInput = {},
|
951
|
+
normalizedProp,
|
952
|
+
prop;
|
953
|
+
|
954
|
+
for (prop in inputObject) {
|
955
|
+
if (hasOwnProp(inputObject, prop)) {
|
956
|
+
normalizedProp = normalizeUnits(prop);
|
957
|
+
if (normalizedProp) {
|
958
|
+
normalizedInput[normalizedProp] = inputObject[prop];
|
959
|
+
}
|
960
|
+
}
|
961
|
+
}
|
962
|
+
|
963
|
+
return normalizedInput;
|
964
|
+
}
|
965
|
+
|
966
|
+
function makeList(field) {
|
967
|
+
var count, setter;
|
968
|
+
|
969
|
+
if (field.indexOf('week') === 0) {
|
970
|
+
count = 7;
|
971
|
+
setter = 'day';
|
972
|
+
}
|
973
|
+
else if (field.indexOf('month') === 0) {
|
974
|
+
count = 12;
|
975
|
+
setter = 'month';
|
976
|
+
}
|
977
|
+
else {
|
978
|
+
return;
|
979
|
+
}
|
980
|
+
|
981
|
+
moment[field] = function (format, index) {
|
982
|
+
var i, getter,
|
983
|
+
method = moment._locale[field],
|
984
|
+
results = [];
|
985
|
+
|
986
|
+
if (typeof format === 'number') {
|
987
|
+
index = format;
|
988
|
+
format = undefined;
|
989
|
+
}
|
990
|
+
|
991
|
+
getter = function (i) {
|
992
|
+
var m = moment().utc().set(setter, i);
|
993
|
+
return method.call(moment._locale, m, format || '');
|
994
|
+
};
|
995
|
+
|
996
|
+
if (index != null) {
|
997
|
+
return getter(index);
|
998
|
+
}
|
999
|
+
else {
|
1000
|
+
for (i = 0; i < count; i++) {
|
1001
|
+
results.push(getter(i));
|
1002
|
+
}
|
1003
|
+
return results;
|
1004
|
+
}
|
1005
|
+
};
|
1006
|
+
}
|
1007
|
+
|
1008
|
+
function toInt(argumentForCoercion) {
|
1009
|
+
var coercedNumber = +argumentForCoercion,
|
1010
|
+
value = 0;
|
1011
|
+
|
1012
|
+
if (coercedNumber !== 0 && isFinite(coercedNumber)) {
|
1013
|
+
if (coercedNumber >= 0) {
|
1014
|
+
value = Math.floor(coercedNumber);
|
1015
|
+
} else {
|
1016
|
+
value = Math.ceil(coercedNumber);
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
return value;
|
1021
|
+
}
|
1022
|
+
|
1023
|
+
function daysInMonth(year, month) {
|
1024
|
+
return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
function weeksInYear(year, dow, doy) {
|
1028
|
+
return weekOfYear(moment([year, 11, 31 + dow - doy]), dow, doy).week;
|
1029
|
+
}
|
1030
|
+
|
1031
|
+
function daysInYear(year) {
|
1032
|
+
return isLeapYear(year) ? 366 : 365;
|
1033
|
+
}
|
1034
|
+
|
1035
|
+
function isLeapYear(year) {
|
1036
|
+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
|
1037
|
+
}
|
1038
|
+
|
1039
|
+
function checkOverflow(m) {
|
1040
|
+
var overflow;
|
1041
|
+
if (m._a && m._pf.overflow === -2) {
|
1042
|
+
overflow =
|
1043
|
+
m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
|
1044
|
+
m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
|
1045
|
+
m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
|
1046
|
+
m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
|
1047
|
+
m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
|
1048
|
+
m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
|
1049
|
+
-1;
|
1050
|
+
|
1051
|
+
if (m._pf._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) {
|
1052
|
+
overflow = DATE;
|
1053
|
+
}
|
1054
|
+
|
1055
|
+
m._pf.overflow = overflow;
|
1056
|
+
}
|
1057
|
+
}
|
1058
|
+
|
1059
|
+
function isValid(m) {
|
1060
|
+
if (m._isValid == null) {
|
1061
|
+
m._isValid = !isNaN(m._d.getTime()) &&
|
1062
|
+
m._pf.overflow < 0 &&
|
1063
|
+
!m._pf.empty &&
|
1064
|
+
!m._pf.invalidMonth &&
|
1065
|
+
!m._pf.nullInput &&
|
1066
|
+
!m._pf.invalidFormat &&
|
1067
|
+
!m._pf.userInvalidated;
|
1068
|
+
|
1069
|
+
if (m._strict) {
|
1070
|
+
m._isValid = m._isValid &&
|
1071
|
+
m._pf.charsLeftOver === 0 &&
|
1072
|
+
m._pf.unusedTokens.length === 0;
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
return m._isValid;
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
function normalizeLocale(key) {
|
1079
|
+
return key ? key.toLowerCase().replace('_', '-') : key;
|
1080
|
+
}
|
1081
|
+
|
1082
|
+
// pick the locale from the array
|
1083
|
+
// try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
|
1084
|
+
// substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
|
1085
|
+
function chooseLocale(names) {
|
1086
|
+
var i = 0, j, next, locale, split;
|
1087
|
+
|
1088
|
+
while (i < names.length) {
|
1089
|
+
split = normalizeLocale(names[i]).split('-');
|
1090
|
+
j = split.length;
|
1091
|
+
next = normalizeLocale(names[i + 1]);
|
1092
|
+
next = next ? next.split('-') : null;
|
1093
|
+
while (j > 0) {
|
1094
|
+
locale = loadLocale(split.slice(0, j).join('-'));
|
1095
|
+
if (locale) {
|
1096
|
+
return locale;
|
1097
|
+
}
|
1098
|
+
if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) {
|
1099
|
+
//the next array item is better than a shallower substring of this one
|
1100
|
+
break;
|
1101
|
+
}
|
1102
|
+
j--;
|
1103
|
+
}
|
1104
|
+
i++;
|
1105
|
+
}
|
1106
|
+
return null;
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
function loadLocale(name) {
|
1110
|
+
var oldLocale = null;
|
1111
|
+
if (!locales[name] && hasModule) {
|
1112
|
+
try {
|
1113
|
+
oldLocale = moment.locale();
|
1114
|
+
require('./locale/' + name);
|
1115
|
+
// because defineLocale currently also sets the global locale, we want to undo that for lazy loaded locales
|
1116
|
+
moment.locale(oldLocale);
|
1117
|
+
} catch (e) { }
|
1118
|
+
}
|
1119
|
+
return locales[name];
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
// Return a moment from input, that is local/utc/zone equivalent to model.
|
1123
|
+
function makeAs(input, model) {
|
1124
|
+
return model._isUTC ? moment(input).zone(model._offset || 0) :
|
1125
|
+
moment(input).local();
|
1126
|
+
}
|
1127
|
+
|
1128
|
+
/************************************
|
1129
|
+
Locale
|
1130
|
+
************************************/
|
1131
|
+
|
1132
|
+
|
1133
|
+
extend(Locale.prototype, {
|
1134
|
+
|
1135
|
+
set : function (config) {
|
1136
|
+
var prop, i;
|
1137
|
+
for (i in config) {
|
1138
|
+
prop = config[i];
|
1139
|
+
if (typeof prop === 'function') {
|
1140
|
+
this[i] = prop;
|
1141
|
+
} else {
|
1142
|
+
this['_' + i] = prop;
|
1143
|
+
}
|
1144
|
+
}
|
1145
|
+
},
|
1146
|
+
|
1147
|
+
_months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
|
1148
|
+
months : function (m) {
|
1149
|
+
return this._months[m.month()];
|
1150
|
+
},
|
1151
|
+
|
1152
|
+
_monthsShort : 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
|
1153
|
+
monthsShort : function (m) {
|
1154
|
+
return this._monthsShort[m.month()];
|
1155
|
+
},
|
1156
|
+
|
1157
|
+
monthsParse : function (monthName) {
|
1158
|
+
var i, mom, regex;
|
1159
|
+
|
1160
|
+
if (!this._monthsParse) {
|
1161
|
+
this._monthsParse = [];
|
1162
|
+
}
|
1163
|
+
|
1164
|
+
for (i = 0; i < 12; i++) {
|
1165
|
+
// make the regex if we don't have it already
|
1166
|
+
if (!this._monthsParse[i]) {
|
1167
|
+
mom = moment.utc([2000, i]);
|
1168
|
+
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
|
1169
|
+
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
1170
|
+
}
|
1171
|
+
// test the regex
|
1172
|
+
if (this._monthsParse[i].test(monthName)) {
|
1173
|
+
return i;
|
1174
|
+
}
|
1175
|
+
}
|
1176
|
+
},
|
1177
|
+
|
1178
|
+
_weekdays : 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
|
1179
|
+
weekdays : function (m) {
|
1180
|
+
return this._weekdays[m.day()];
|
1181
|
+
},
|
1182
|
+
|
1183
|
+
_weekdaysShort : 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
|
1184
|
+
weekdaysShort : function (m) {
|
1185
|
+
return this._weekdaysShort[m.day()];
|
1186
|
+
},
|
1187
|
+
|
1188
|
+
_weekdaysMin : 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
|
1189
|
+
weekdaysMin : function (m) {
|
1190
|
+
return this._weekdaysMin[m.day()];
|
1191
|
+
},
|
1192
|
+
|
1193
|
+
weekdaysParse : function (weekdayName) {
|
1194
|
+
var i, mom, regex;
|
1195
|
+
|
1196
|
+
if (!this._weekdaysParse) {
|
1197
|
+
this._weekdaysParse = [];
|
1198
|
+
}
|
1199
|
+
|
1200
|
+
for (i = 0; i < 7; i++) {
|
1201
|
+
// make the regex if we don't have it already
|
1202
|
+
if (!this._weekdaysParse[i]) {
|
1203
|
+
mom = moment([2000, 1]).day(i);
|
1204
|
+
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
1205
|
+
this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
|
1206
|
+
}
|
1207
|
+
// test the regex
|
1208
|
+
if (this._weekdaysParse[i].test(weekdayName)) {
|
1209
|
+
return i;
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
},
|
1213
|
+
|
1214
|
+
_longDateFormat : {
|
1215
|
+
LT : 'h:mm A',
|
1216
|
+
L : 'MM/DD/YYYY',
|
1217
|
+
LL : 'MMMM D, YYYY',
|
1218
|
+
LLL : 'MMMM D, YYYY LT',
|
1219
|
+
LLLL : 'dddd, MMMM D, YYYY LT'
|
1220
|
+
},
|
1221
|
+
longDateFormat : function (key) {
|
1222
|
+
var output = this._longDateFormat[key];
|
1223
|
+
if (!output && this._longDateFormat[key.toUpperCase()]) {
|
1224
|
+
output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) {
|
1225
|
+
return val.slice(1);
|
1226
|
+
});
|
1227
|
+
this._longDateFormat[key] = output;
|
1228
|
+
}
|
1229
|
+
return output;
|
1230
|
+
},
|
1231
|
+
|
1232
|
+
isPM : function (input) {
|
1233
|
+
// IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
|
1234
|
+
// Using charAt should be more compatible.
|
1235
|
+
return ((input + '').toLowerCase().charAt(0) === 'p');
|
1236
|
+
},
|
1237
|
+
|
1238
|
+
_meridiemParse : /[ap]\.?m?\.?/i,
|
1239
|
+
meridiem : function (hours, minutes, isLower) {
|
1240
|
+
if (hours > 11) {
|
1241
|
+
return isLower ? 'pm' : 'PM';
|
1242
|
+
} else {
|
1243
|
+
return isLower ? 'am' : 'AM';
|
1244
|
+
}
|
1245
|
+
},
|
1246
|
+
|
1247
|
+
_calendar : {
|
1248
|
+
sameDay : '[Today at] LT',
|
1249
|
+
nextDay : '[Tomorrow at] LT',
|
1250
|
+
nextWeek : 'dddd [at] LT',
|
1251
|
+
lastDay : '[Yesterday at] LT',
|
1252
|
+
lastWeek : '[Last] dddd [at] LT',
|
1253
|
+
sameElse : 'L'
|
1254
|
+
},
|
1255
|
+
calendar : function (key, mom) {
|
1256
|
+
var output = this._calendar[key];
|
1257
|
+
return typeof output === 'function' ? output.apply(mom) : output;
|
1258
|
+
},
|
1259
|
+
|
1260
|
+
_relativeTime : {
|
1261
|
+
future : 'in %s',
|
1262
|
+
past : '%s ago',
|
1263
|
+
s : 'a few seconds',
|
1264
|
+
m : 'a minute',
|
1265
|
+
mm : '%d minutes',
|
1266
|
+
h : 'an hour',
|
1267
|
+
hh : '%d hours',
|
1268
|
+
d : 'a day',
|
1269
|
+
dd : '%d days',
|
1270
|
+
M : 'a month',
|
1271
|
+
MM : '%d months',
|
1272
|
+
y : 'a year',
|
1273
|
+
yy : '%d years'
|
1274
|
+
},
|
1275
|
+
|
1276
|
+
relativeTime : function (number, withoutSuffix, string, isFuture) {
|
1277
|
+
var output = this._relativeTime[string];
|
1278
|
+
return (typeof output === 'function') ?
|
1279
|
+
output(number, withoutSuffix, string, isFuture) :
|
1280
|
+
output.replace(/%d/i, number);
|
1281
|
+
},
|
1282
|
+
|
1283
|
+
pastFuture : function (diff, output) {
|
1284
|
+
var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
|
1285
|
+
return typeof format === 'function' ? format(output) : format.replace(/%s/i, output);
|
1286
|
+
},
|
1287
|
+
|
1288
|
+
ordinal : function (number) {
|
1289
|
+
return this._ordinal.replace('%d', number);
|
1290
|
+
},
|
1291
|
+
_ordinal : '%d',
|
1292
|
+
|
1293
|
+
preparse : function (string) {
|
1294
|
+
return string;
|
1295
|
+
},
|
1296
|
+
|
1297
|
+
postformat : function (string) {
|
1298
|
+
return string;
|
1299
|
+
},
|
1300
|
+
|
1301
|
+
week : function (mom) {
|
1302
|
+
return weekOfYear(mom, this._week.dow, this._week.doy).week;
|
1303
|
+
},
|
1304
|
+
|
1305
|
+
_week : {
|
1306
|
+
dow : 0, // Sunday is the first day of the week.
|
1307
|
+
doy : 6 // The week that contains Jan 1st is the first week of the year.
|
1308
|
+
},
|
1309
|
+
|
1310
|
+
_invalidDate: 'Invalid date',
|
1311
|
+
invalidDate: function () {
|
1312
|
+
return this._invalidDate;
|
1313
|
+
}
|
1314
|
+
});
|
1315
|
+
|
1316
|
+
/************************************
|
1317
|
+
Formatting
|
1318
|
+
************************************/
|
1319
|
+
|
1320
|
+
|
1321
|
+
function removeFormattingTokens(input) {
|
1322
|
+
if (input.match(/\[[\s\S]/)) {
|
1323
|
+
return input.replace(/^\[|\]$/g, '');
|
1324
|
+
}
|
1325
|
+
return input.replace(/\\/g, '');
|
1326
|
+
}
|
1327
|
+
|
1328
|
+
function makeFormatFunction(format) {
|
1329
|
+
var array = format.match(formattingTokens), i, length;
|
1330
|
+
|
1331
|
+
for (i = 0, length = array.length; i < length; i++) {
|
1332
|
+
if (formatTokenFunctions[array[i]]) {
|
1333
|
+
array[i] = formatTokenFunctions[array[i]];
|
1334
|
+
} else {
|
1335
|
+
array[i] = removeFormattingTokens(array[i]);
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
return function (mom) {
|
1340
|
+
var output = '';
|
1341
|
+
for (i = 0; i < length; i++) {
|
1342
|
+
output += array[i] instanceof Function ? array[i].call(mom, format) : array[i];
|
1343
|
+
}
|
1344
|
+
return output;
|
1345
|
+
};
|
1346
|
+
}
|
1347
|
+
|
1348
|
+
// format date using native date object
|
1349
|
+
function formatMoment(m, format) {
|
1350
|
+
if (!m.isValid()) {
|
1351
|
+
return m.localeData().invalidDate();
|
1352
|
+
}
|
1353
|
+
|
1354
|
+
format = expandFormat(format, m.localeData());
|
1355
|
+
|
1356
|
+
if (!formatFunctions[format]) {
|
1357
|
+
formatFunctions[format] = makeFormatFunction(format);
|
1358
|
+
}
|
1359
|
+
|
1360
|
+
return formatFunctions[format](m);
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
function expandFormat(format, locale) {
|
1364
|
+
var i = 5;
|
1365
|
+
|
1366
|
+
function replaceLongDateFormatTokens(input) {
|
1367
|
+
return locale.longDateFormat(input) || input;
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
localFormattingTokens.lastIndex = 0;
|
1371
|
+
while (i >= 0 && localFormattingTokens.test(format)) {
|
1372
|
+
format = format.replace(localFormattingTokens, replaceLongDateFormatTokens);
|
1373
|
+
localFormattingTokens.lastIndex = 0;
|
1374
|
+
i -= 1;
|
1375
|
+
}
|
1376
|
+
|
1377
|
+
return format;
|
1378
|
+
}
|
1379
|
+
|
1380
|
+
|
1381
|
+
/************************************
|
1382
|
+
Parsing
|
1383
|
+
************************************/
|
1384
|
+
|
1385
|
+
|
1386
|
+
// get the regex to find the next token
|
1387
|
+
function getParseRegexForToken(token, config) {
|
1388
|
+
var a, strict = config._strict;
|
1389
|
+
switch (token) {
|
1390
|
+
case 'Q':
|
1391
|
+
return parseTokenOneDigit;
|
1392
|
+
case 'DDDD':
|
1393
|
+
return parseTokenThreeDigits;
|
1394
|
+
case 'YYYY':
|
1395
|
+
case 'GGGG':
|
1396
|
+
case 'gggg':
|
1397
|
+
return strict ? parseTokenFourDigits : parseTokenOneToFourDigits;
|
1398
|
+
case 'Y':
|
1399
|
+
case 'G':
|
1400
|
+
case 'g':
|
1401
|
+
return parseTokenSignedNumber;
|
1402
|
+
case 'YYYYYY':
|
1403
|
+
case 'YYYYY':
|
1404
|
+
case 'GGGGG':
|
1405
|
+
case 'ggggg':
|
1406
|
+
return strict ? parseTokenSixDigits : parseTokenOneToSixDigits;
|
1407
|
+
case 'S':
|
1408
|
+
if (strict) {
|
1409
|
+
return parseTokenOneDigit;
|
1410
|
+
}
|
1411
|
+
/* falls through */
|
1412
|
+
case 'SS':
|
1413
|
+
if (strict) {
|
1414
|
+
return parseTokenTwoDigits;
|
1415
|
+
}
|
1416
|
+
/* falls through */
|
1417
|
+
case 'SSS':
|
1418
|
+
if (strict) {
|
1419
|
+
return parseTokenThreeDigits;
|
1420
|
+
}
|
1421
|
+
/* falls through */
|
1422
|
+
case 'DDD':
|
1423
|
+
return parseTokenOneToThreeDigits;
|
1424
|
+
case 'MMM':
|
1425
|
+
case 'MMMM':
|
1426
|
+
case 'dd':
|
1427
|
+
case 'ddd':
|
1428
|
+
case 'dddd':
|
1429
|
+
return parseTokenWord;
|
1430
|
+
case 'a':
|
1431
|
+
case 'A':
|
1432
|
+
return config._locale._meridiemParse;
|
1433
|
+
case 'X':
|
1434
|
+
return parseTokenTimestampMs;
|
1435
|
+
case 'Z':
|
1436
|
+
case 'ZZ':
|
1437
|
+
return parseTokenTimezone;
|
1438
|
+
case 'T':
|
1439
|
+
return parseTokenT;
|
1440
|
+
case 'SSSS':
|
1441
|
+
return parseTokenDigits;
|
1442
|
+
case 'MM':
|
1443
|
+
case 'DD':
|
1444
|
+
case 'YY':
|
1445
|
+
case 'GG':
|
1446
|
+
case 'gg':
|
1447
|
+
case 'HH':
|
1448
|
+
case 'hh':
|
1449
|
+
case 'mm':
|
1450
|
+
case 'ss':
|
1451
|
+
case 'ww':
|
1452
|
+
case 'WW':
|
1453
|
+
return strict ? parseTokenTwoDigits : parseTokenOneOrTwoDigits;
|
1454
|
+
case 'M':
|
1455
|
+
case 'D':
|
1456
|
+
case 'd':
|
1457
|
+
case 'H':
|
1458
|
+
case 'h':
|
1459
|
+
case 'm':
|
1460
|
+
case 's':
|
1461
|
+
case 'w':
|
1462
|
+
case 'W':
|
1463
|
+
case 'e':
|
1464
|
+
case 'E':
|
1465
|
+
return parseTokenOneOrTwoDigits;
|
1466
|
+
case 'Do':
|
1467
|
+
return parseTokenOrdinal;
|
1468
|
+
default :
|
1469
|
+
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i'));
|
1470
|
+
return a;
|
1471
|
+
}
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
function timezoneMinutesFromString(string) {
|
1475
|
+
string = string || '';
|
1476
|
+
var possibleTzMatches = (string.match(parseTokenTimezone) || []),
|
1477
|
+
tzChunk = possibleTzMatches[possibleTzMatches.length - 1] || [],
|
1478
|
+
parts = (tzChunk + '').match(parseTimezoneChunker) || ['-', 0, 0],
|
1479
|
+
minutes = +(parts[1] * 60) + toInt(parts[2]);
|
1480
|
+
|
1481
|
+
return parts[0] === '+' ? -minutes : minutes;
|
1482
|
+
}
|
1483
|
+
|
1484
|
+
// function to convert string input to date
|
1485
|
+
function addTimeToArrayFromToken(token, input, config) {
|
1486
|
+
var a, datePartArray = config._a;
|
1487
|
+
|
1488
|
+
switch (token) {
|
1489
|
+
// QUARTER
|
1490
|
+
case 'Q':
|
1491
|
+
if (input != null) {
|
1492
|
+
datePartArray[MONTH] = (toInt(input) - 1) * 3;
|
1493
|
+
}
|
1494
|
+
break;
|
1495
|
+
// MONTH
|
1496
|
+
case 'M' : // fall through to MM
|
1497
|
+
case 'MM' :
|
1498
|
+
if (input != null) {
|
1499
|
+
datePartArray[MONTH] = toInt(input) - 1;
|
1500
|
+
}
|
1501
|
+
break;
|
1502
|
+
case 'MMM' : // fall through to MMMM
|
1503
|
+
case 'MMMM' :
|
1504
|
+
a = config._locale.monthsParse(input);
|
1505
|
+
// if we didn't find a month name, mark the date as invalid.
|
1506
|
+
if (a != null) {
|
1507
|
+
datePartArray[MONTH] = a;
|
1508
|
+
} else {
|
1509
|
+
config._pf.invalidMonth = input;
|
1510
|
+
}
|
1511
|
+
break;
|
1512
|
+
// DAY OF MONTH
|
1513
|
+
case 'D' : // fall through to DD
|
1514
|
+
case 'DD' :
|
1515
|
+
if (input != null) {
|
1516
|
+
datePartArray[DATE] = toInt(input);
|
1517
|
+
}
|
1518
|
+
break;
|
1519
|
+
case 'Do' :
|
1520
|
+
if (input != null) {
|
1521
|
+
datePartArray[DATE] = toInt(parseInt(input, 10));
|
1522
|
+
}
|
1523
|
+
break;
|
1524
|
+
// DAY OF YEAR
|
1525
|
+
case 'DDD' : // fall through to DDDD
|
1526
|
+
case 'DDDD' :
|
1527
|
+
if (input != null) {
|
1528
|
+
config._dayOfYear = toInt(input);
|
1529
|
+
}
|
1530
|
+
|
1531
|
+
break;
|
1532
|
+
// YEAR
|
1533
|
+
case 'YY' :
|
1534
|
+
datePartArray[YEAR] = moment.parseTwoDigitYear(input);
|
1535
|
+
break;
|
1536
|
+
case 'YYYY' :
|
1537
|
+
case 'YYYYY' :
|
1538
|
+
case 'YYYYYY' :
|
1539
|
+
datePartArray[YEAR] = toInt(input);
|
1540
|
+
break;
|
1541
|
+
// AM / PM
|
1542
|
+
case 'a' : // fall through to A
|
1543
|
+
case 'A' :
|
1544
|
+
config._isPm = config._locale.isPM(input);
|
1545
|
+
break;
|
1546
|
+
// 24 HOUR
|
1547
|
+
case 'H' : // fall through to hh
|
1548
|
+
case 'HH' : // fall through to hh
|
1549
|
+
case 'h' : // fall through to hh
|
1550
|
+
case 'hh' :
|
1551
|
+
datePartArray[HOUR] = toInt(input);
|
1552
|
+
break;
|
1553
|
+
// MINUTE
|
1554
|
+
case 'm' : // fall through to mm
|
1555
|
+
case 'mm' :
|
1556
|
+
datePartArray[MINUTE] = toInt(input);
|
1557
|
+
break;
|
1558
|
+
// SECOND
|
1559
|
+
case 's' : // fall through to ss
|
1560
|
+
case 'ss' :
|
1561
|
+
datePartArray[SECOND] = toInt(input);
|
1562
|
+
break;
|
1563
|
+
// MILLISECOND
|
1564
|
+
case 'S' :
|
1565
|
+
case 'SS' :
|
1566
|
+
case 'SSS' :
|
1567
|
+
case 'SSSS' :
|
1568
|
+
datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
|
1569
|
+
break;
|
1570
|
+
// UNIX TIMESTAMP WITH MS
|
1571
|
+
case 'X':
|
1572
|
+
config._d = new Date(parseFloat(input) * 1000);
|
1573
|
+
break;
|
1574
|
+
// TIMEZONE
|
1575
|
+
case 'Z' : // fall through to ZZ
|
1576
|
+
case 'ZZ' :
|
1577
|
+
config._useUTC = true;
|
1578
|
+
config._tzm = timezoneMinutesFromString(input);
|
1579
|
+
break;
|
1580
|
+
// WEEKDAY - human
|
1581
|
+
case 'dd':
|
1582
|
+
case 'ddd':
|
1583
|
+
case 'dddd':
|
1584
|
+
a = config._locale.weekdaysParse(input);
|
1585
|
+
// if we didn't get a weekday name, mark the date as invalid
|
1586
|
+
if (a != null) {
|
1587
|
+
config._w = config._w || {};
|
1588
|
+
config._w['d'] = a;
|
1589
|
+
} else {
|
1590
|
+
config._pf.invalidWeekday = input;
|
1591
|
+
}
|
1592
|
+
break;
|
1593
|
+
// WEEK, WEEK DAY - numeric
|
1594
|
+
case 'w':
|
1595
|
+
case 'ww':
|
1596
|
+
case 'W':
|
1597
|
+
case 'WW':
|
1598
|
+
case 'd':
|
1599
|
+
case 'e':
|
1600
|
+
case 'E':
|
1601
|
+
token = token.substr(0, 1);
|
1602
|
+
/* falls through */
|
1603
|
+
case 'gggg':
|
1604
|
+
case 'GGGG':
|
1605
|
+
case 'GGGGG':
|
1606
|
+
token = token.substr(0, 2);
|
1607
|
+
if (input) {
|
1608
|
+
config._w = config._w || {};
|
1609
|
+
config._w[token] = toInt(input);
|
1610
|
+
}
|
1611
|
+
break;
|
1612
|
+
case 'gg':
|
1613
|
+
case 'GG':
|
1614
|
+
config._w = config._w || {};
|
1615
|
+
config._w[token] = moment.parseTwoDigitYear(input);
|
1616
|
+
}
|
1617
|
+
}
|
1618
|
+
|
1619
|
+
function dayOfYearFromWeekInfo(config) {
|
1620
|
+
var w, weekYear, week, weekday, dow, doy, temp;
|
1621
|
+
|
1622
|
+
w = config._w;
|
1623
|
+
if (w.GG != null || w.W != null || w.E != null) {
|
1624
|
+
dow = 1;
|
1625
|
+
doy = 4;
|
1626
|
+
|
1627
|
+
// TODO: We need to take the current isoWeekYear, but that depends on
|
1628
|
+
// how we interpret now (local, utc, fixed offset). So create
|
1629
|
+
// a now version of current config (take local/utc/offset flags, and
|
1630
|
+
// create now).
|
1631
|
+
weekYear = dfl(w.GG, config._a[YEAR], weekOfYear(moment(), 1, 4).year);
|
1632
|
+
week = dfl(w.W, 1);
|
1633
|
+
weekday = dfl(w.E, 1);
|
1634
|
+
} else {
|
1635
|
+
dow = config._locale._week.dow;
|
1636
|
+
doy = config._locale._week.doy;
|
1637
|
+
|
1638
|
+
weekYear = dfl(w.gg, config._a[YEAR], weekOfYear(moment(), dow, doy).year);
|
1639
|
+
week = dfl(w.w, 1);
|
1640
|
+
|
1641
|
+
if (w.d != null) {
|
1642
|
+
// weekday -- low day numbers are considered next week
|
1643
|
+
weekday = w.d;
|
1644
|
+
if (weekday < dow) {
|
1645
|
+
++week;
|
1646
|
+
}
|
1647
|
+
} else if (w.e != null) {
|
1648
|
+
// local weekday -- counting starts from begining of week
|
1649
|
+
weekday = w.e + dow;
|
1650
|
+
} else {
|
1651
|
+
// default to begining of week
|
1652
|
+
weekday = dow;
|
1653
|
+
}
|
1654
|
+
}
|
1655
|
+
temp = dayOfYearFromWeeks(weekYear, week, weekday, doy, dow);
|
1656
|
+
|
1657
|
+
config._a[YEAR] = temp.year;
|
1658
|
+
config._dayOfYear = temp.dayOfYear;
|
1659
|
+
}
|
1660
|
+
|
1661
|
+
// convert an array to a date.
|
1662
|
+
// the array should mirror the parameters below
|
1663
|
+
// note: all values past the year are optional and will default to the lowest possible value.
|
1664
|
+
// [year, month, day , hour, minute, second, millisecond]
|
1665
|
+
function dateFromConfig(config) {
|
1666
|
+
var i, date, input = [], currentDate, yearToUse;
|
1667
|
+
|
1668
|
+
if (config._d) {
|
1669
|
+
return;
|
1670
|
+
}
|
1671
|
+
|
1672
|
+
currentDate = currentDateArray(config);
|
1673
|
+
|
1674
|
+
//compute day of the year from weeks and weekdays
|
1675
|
+
if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
|
1676
|
+
dayOfYearFromWeekInfo(config);
|
1677
|
+
}
|
1678
|
+
|
1679
|
+
//if the day of the year is set, figure out what it is
|
1680
|
+
if (config._dayOfYear) {
|
1681
|
+
yearToUse = dfl(config._a[YEAR], currentDate[YEAR]);
|
1682
|
+
|
1683
|
+
if (config._dayOfYear > daysInYear(yearToUse)) {
|
1684
|
+
config._pf._overflowDayOfYear = true;
|
1685
|
+
}
|
1686
|
+
|
1687
|
+
date = makeUTCDate(yearToUse, 0, config._dayOfYear);
|
1688
|
+
config._a[MONTH] = date.getUTCMonth();
|
1689
|
+
config._a[DATE] = date.getUTCDate();
|
1690
|
+
}
|
1691
|
+
|
1692
|
+
// Default to current date.
|
1693
|
+
// * if no year, month, day of month are given, default to today
|
1694
|
+
// * if day of month is given, default month and year
|
1695
|
+
// * if month is given, default only year
|
1696
|
+
// * if year is given, don't default anything
|
1697
|
+
for (i = 0; i < 3 && config._a[i] == null; ++i) {
|
1698
|
+
config._a[i] = input[i] = currentDate[i];
|
1699
|
+
}
|
1700
|
+
|
1701
|
+
// Zero out whatever was not defaulted, including time
|
1702
|
+
for (; i < 7; i++) {
|
1703
|
+
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
|
1704
|
+
}
|
1705
|
+
|
1706
|
+
config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
|
1707
|
+
// Apply timezone offset from input. The actual zone can be changed
|
1708
|
+
// with parseZone.
|
1709
|
+
if (config._tzm != null) {
|
1710
|
+
config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
|
1711
|
+
}
|
1712
|
+
}
|
1713
|
+
|
1714
|
+
function dateFromObject(config) {
|
1715
|
+
var normalizedInput;
|
1716
|
+
|
1717
|
+
if (config._d) {
|
1718
|
+
return;
|
1719
|
+
}
|
1720
|
+
|
1721
|
+
normalizedInput = normalizeObjectUnits(config._i);
|
1722
|
+
config._a = [
|
1723
|
+
normalizedInput.year,
|
1724
|
+
normalizedInput.month,
|
1725
|
+
normalizedInput.day,
|
1726
|
+
normalizedInput.hour,
|
1727
|
+
normalizedInput.minute,
|
1728
|
+
normalizedInput.second,
|
1729
|
+
normalizedInput.millisecond
|
1730
|
+
];
|
1731
|
+
|
1732
|
+
dateFromConfig(config);
|
1733
|
+
}
|
1734
|
+
|
1735
|
+
function currentDateArray(config) {
|
1736
|
+
var now = new Date();
|
1737
|
+
if (config._useUTC) {
|
1738
|
+
return [
|
1739
|
+
now.getUTCFullYear(),
|
1740
|
+
now.getUTCMonth(),
|
1741
|
+
now.getUTCDate()
|
1742
|
+
];
|
1743
|
+
} else {
|
1744
|
+
return [now.getFullYear(), now.getMonth(), now.getDate()];
|
1745
|
+
}
|
1746
|
+
}
|
1747
|
+
|
1748
|
+
// date from string and format string
|
1749
|
+
function makeDateFromStringAndFormat(config) {
|
1750
|
+
if (config._f === moment.ISO_8601) {
|
1751
|
+
parseISO(config);
|
1752
|
+
return;
|
1753
|
+
}
|
1754
|
+
|
1755
|
+
config._a = [];
|
1756
|
+
config._pf.empty = true;
|
1757
|
+
|
1758
|
+
// This array is used to make a Date, either with `new Date` or `Date.UTC`
|
1759
|
+
var string = '' + config._i,
|
1760
|
+
i, parsedInput, tokens, token, skipped,
|
1761
|
+
stringLength = string.length,
|
1762
|
+
totalParsedInputLength = 0;
|
1763
|
+
|
1764
|
+
tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [];
|
1765
|
+
|
1766
|
+
for (i = 0; i < tokens.length; i++) {
|
1767
|
+
token = tokens[i];
|
1768
|
+
parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0];
|
1769
|
+
if (parsedInput) {
|
1770
|
+
skipped = string.substr(0, string.indexOf(parsedInput));
|
1771
|
+
if (skipped.length > 0) {
|
1772
|
+
config._pf.unusedInput.push(skipped);
|
1773
|
+
}
|
1774
|
+
string = string.slice(string.indexOf(parsedInput) + parsedInput.length);
|
1775
|
+
totalParsedInputLength += parsedInput.length;
|
1776
|
+
}
|
1777
|
+
// don't parse if it's not a known token
|
1778
|
+
if (formatTokenFunctions[token]) {
|
1779
|
+
if (parsedInput) {
|
1780
|
+
config._pf.empty = false;
|
1781
|
+
}
|
1782
|
+
else {
|
1783
|
+
config._pf.unusedTokens.push(token);
|
1784
|
+
}
|
1785
|
+
addTimeToArrayFromToken(token, parsedInput, config);
|
1786
|
+
}
|
1787
|
+
else if (config._strict && !parsedInput) {
|
1788
|
+
config._pf.unusedTokens.push(token);
|
1789
|
+
}
|
1790
|
+
}
|
1791
|
+
|
1792
|
+
// add remaining unparsed input length to the string
|
1793
|
+
config._pf.charsLeftOver = stringLength - totalParsedInputLength;
|
1794
|
+
if (string.length > 0) {
|
1795
|
+
config._pf.unusedInput.push(string);
|
1796
|
+
}
|
1797
|
+
|
1798
|
+
// handle am pm
|
1799
|
+
if (config._isPm && config._a[HOUR] < 12) {
|
1800
|
+
config._a[HOUR] += 12;
|
1801
|
+
}
|
1802
|
+
// if is 12 am, change hours to 0
|
1803
|
+
if (config._isPm === false && config._a[HOUR] === 12) {
|
1804
|
+
config._a[HOUR] = 0;
|
1805
|
+
}
|
1806
|
+
|
1807
|
+
dateFromConfig(config);
|
1808
|
+
checkOverflow(config);
|
1809
|
+
}
|
1810
|
+
|
1811
|
+
function unescapeFormat(s) {
|
1812
|
+
return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function (matched, p1, p2, p3, p4) {
|
1813
|
+
return p1 || p2 || p3 || p4;
|
1814
|
+
});
|
1815
|
+
}
|
1816
|
+
|
1817
|
+
// Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
|
1818
|
+
function regexpEscape(s) {
|
1819
|
+
return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
|
1820
|
+
}
|
1821
|
+
|
1822
|
+
// date from string and array of format strings
|
1823
|
+
function makeDateFromStringAndArray(config) {
|
1824
|
+
var tempConfig,
|
1825
|
+
bestMoment,
|
1826
|
+
|
1827
|
+
scoreToBeat,
|
1828
|
+
i,
|
1829
|
+
currentScore;
|
1830
|
+
|
1831
|
+
if (config._f.length === 0) {
|
1832
|
+
config._pf.invalidFormat = true;
|
1833
|
+
config._d = new Date(NaN);
|
1834
|
+
return;
|
1835
|
+
}
|
1836
|
+
|
1837
|
+
for (i = 0; i < config._f.length; i++) {
|
1838
|
+
currentScore = 0;
|
1839
|
+
tempConfig = copyConfig({}, config);
|
1840
|
+
if (config._useUTC != null) {
|
1841
|
+
tempConfig._useUTC = config._useUTC;
|
1842
|
+
}
|
1843
|
+
tempConfig._pf = defaultParsingFlags();
|
1844
|
+
tempConfig._f = config._f[i];
|
1845
|
+
makeDateFromStringAndFormat(tempConfig);
|
1846
|
+
|
1847
|
+
if (!isValid(tempConfig)) {
|
1848
|
+
continue;
|
1849
|
+
}
|
1850
|
+
|
1851
|
+
// if there is any input that was not parsed add a penalty for that format
|
1852
|
+
currentScore += tempConfig._pf.charsLeftOver;
|
1853
|
+
|
1854
|
+
//or tokens
|
1855
|
+
currentScore += tempConfig._pf.unusedTokens.length * 10;
|
1856
|
+
|
1857
|
+
tempConfig._pf.score = currentScore;
|
1858
|
+
|
1859
|
+
if (scoreToBeat == null || currentScore < scoreToBeat) {
|
1860
|
+
scoreToBeat = currentScore;
|
1861
|
+
bestMoment = tempConfig;
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
|
1865
|
+
extend(config, bestMoment || tempConfig);
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
// date from iso format
|
1869
|
+
function parseISO(config) {
|
1870
|
+
var i, l,
|
1871
|
+
string = config._i,
|
1872
|
+
match = isoRegex.exec(string);
|
1873
|
+
|
1874
|
+
if (match) {
|
1875
|
+
config._pf.iso = true;
|
1876
|
+
for (i = 0, l = isoDates.length; i < l; i++) {
|
1877
|
+
if (isoDates[i][1].exec(string)) {
|
1878
|
+
// match[5] should be 'T' or undefined
|
1879
|
+
config._f = isoDates[i][0] + (match[6] || ' ');
|
1880
|
+
break;
|
1881
|
+
}
|
1882
|
+
}
|
1883
|
+
for (i = 0, l = isoTimes.length; i < l; i++) {
|
1884
|
+
if (isoTimes[i][1].exec(string)) {
|
1885
|
+
config._f += isoTimes[i][0];
|
1886
|
+
break;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
if (string.match(parseTokenTimezone)) {
|
1890
|
+
config._f += 'Z';
|
1891
|
+
}
|
1892
|
+
makeDateFromStringAndFormat(config);
|
1893
|
+
} else {
|
1894
|
+
config._isValid = false;
|
1895
|
+
}
|
1896
|
+
}
|
1897
|
+
|
1898
|
+
// date from iso format or fallback
|
1899
|
+
function makeDateFromString(config) {
|
1900
|
+
parseISO(config);
|
1901
|
+
if (config._isValid === false) {
|
1902
|
+
delete config._isValid;
|
1903
|
+
moment.createFromInputFallback(config);
|
1904
|
+
}
|
1905
|
+
}
|
1906
|
+
|
1907
|
+
function map(arr, fn) {
|
1908
|
+
var res = [], i;
|
1909
|
+
for (i = 0; i < arr.length; ++i) {
|
1910
|
+
res.push(fn(arr[i], i));
|
1911
|
+
}
|
1912
|
+
return res;
|
1913
|
+
}
|
1914
|
+
|
1915
|
+
function makeDateFromInput(config) {
|
1916
|
+
var input = config._i, matched;
|
1917
|
+
if (input === undefined) {
|
1918
|
+
config._d = new Date();
|
1919
|
+
} else if (isDate(input)) {
|
1920
|
+
config._d = new Date(+input);
|
1921
|
+
} else if ((matched = aspNetJsonRegex.exec(input)) !== null) {
|
1922
|
+
config._d = new Date(+matched[1]);
|
1923
|
+
} else if (typeof input === 'string') {
|
1924
|
+
makeDateFromString(config);
|
1925
|
+
} else if (isArray(input)) {
|
1926
|
+
config._a = map(input.slice(0), function (obj) {
|
1927
|
+
return parseInt(obj, 10);
|
1928
|
+
});
|
1929
|
+
dateFromConfig(config);
|
1930
|
+
} else if (typeof(input) === 'object') {
|
1931
|
+
dateFromObject(config);
|
1932
|
+
} else if (typeof(input) === 'number') {
|
1933
|
+
// from milliseconds
|
1934
|
+
config._d = new Date(input);
|
1935
|
+
} else {
|
1936
|
+
moment.createFromInputFallback(config);
|
1937
|
+
}
|
1938
|
+
}
|
1939
|
+
|
1940
|
+
function makeDate(y, m, d, h, M, s, ms) {
|
1941
|
+
//can't just apply() to create a date:
|
1942
|
+
//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
|
1943
|
+
var date = new Date(y, m, d, h, M, s, ms);
|
1944
|
+
|
1945
|
+
//the date constructor doesn't accept years < 1970
|
1946
|
+
if (y < 1970) {
|
1947
|
+
date.setFullYear(y);
|
1948
|
+
}
|
1949
|
+
return date;
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
function makeUTCDate(y) {
|
1953
|
+
var date = new Date(Date.UTC.apply(null, arguments));
|
1954
|
+
if (y < 1970) {
|
1955
|
+
date.setUTCFullYear(y);
|
1956
|
+
}
|
1957
|
+
return date;
|
1958
|
+
}
|
1959
|
+
|
1960
|
+
function parseWeekday(input, locale) {
|
1961
|
+
if (typeof input === 'string') {
|
1962
|
+
if (!isNaN(input)) {
|
1963
|
+
input = parseInt(input, 10);
|
1964
|
+
}
|
1965
|
+
else {
|
1966
|
+
input = locale.weekdaysParse(input);
|
1967
|
+
if (typeof input !== 'number') {
|
1968
|
+
return null;
|
1969
|
+
}
|
1970
|
+
}
|
1971
|
+
}
|
1972
|
+
return input;
|
1973
|
+
}
|
1974
|
+
|
1975
|
+
/************************************
|
1976
|
+
Relative Time
|
1977
|
+
************************************/
|
1978
|
+
|
1979
|
+
|
1980
|
+
// helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
|
1981
|
+
function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
|
1982
|
+
return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
function relativeTime(posNegDuration, withoutSuffix, locale) {
|
1986
|
+
var duration = moment.duration(posNegDuration).abs(),
|
1987
|
+
seconds = round(duration.as('s')),
|
1988
|
+
minutes = round(duration.as('m')),
|
1989
|
+
hours = round(duration.as('h')),
|
1990
|
+
days = round(duration.as('d')),
|
1991
|
+
months = round(duration.as('M')),
|
1992
|
+
years = round(duration.as('y')),
|
1993
|
+
|
1994
|
+
args = seconds < relativeTimeThresholds.s && ['s', seconds] ||
|
1995
|
+
minutes === 1 && ['m'] ||
|
1996
|
+
minutes < relativeTimeThresholds.m && ['mm', minutes] ||
|
1997
|
+
hours === 1 && ['h'] ||
|
1998
|
+
hours < relativeTimeThresholds.h && ['hh', hours] ||
|
1999
|
+
days === 1 && ['d'] ||
|
2000
|
+
days < relativeTimeThresholds.d && ['dd', days] ||
|
2001
|
+
months === 1 && ['M'] ||
|
2002
|
+
months < relativeTimeThresholds.M && ['MM', months] ||
|
2003
|
+
years === 1 && ['y'] || ['yy', years];
|
2004
|
+
|
2005
|
+
args[2] = withoutSuffix;
|
2006
|
+
args[3] = +posNegDuration > 0;
|
2007
|
+
args[4] = locale;
|
2008
|
+
return substituteTimeAgo.apply({}, args);
|
2009
|
+
}
|
2010
|
+
|
2011
|
+
|
2012
|
+
/************************************
|
2013
|
+
Week of Year
|
2014
|
+
************************************/
|
2015
|
+
|
2016
|
+
|
2017
|
+
// firstDayOfWeek 0 = sun, 6 = sat
|
2018
|
+
// the day of the week that starts the week
|
2019
|
+
// (usually sunday or monday)
|
2020
|
+
// firstDayOfWeekOfYear 0 = sun, 6 = sat
|
2021
|
+
// the first week is the week that contains the first
|
2022
|
+
// of this day of the week
|
2023
|
+
// (eg. ISO weeks use thursday (4))
|
2024
|
+
function weekOfYear(mom, firstDayOfWeek, firstDayOfWeekOfYear) {
|
2025
|
+
var end = firstDayOfWeekOfYear - firstDayOfWeek,
|
2026
|
+
daysToDayOfWeek = firstDayOfWeekOfYear - mom.day(),
|
2027
|
+
adjustedMoment;
|
2028
|
+
|
2029
|
+
|
2030
|
+
if (daysToDayOfWeek > end) {
|
2031
|
+
daysToDayOfWeek -= 7;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
if (daysToDayOfWeek < end - 7) {
|
2035
|
+
daysToDayOfWeek += 7;
|
2036
|
+
}
|
2037
|
+
|
2038
|
+
adjustedMoment = moment(mom).add(daysToDayOfWeek, 'd');
|
2039
|
+
return {
|
2040
|
+
week: Math.ceil(adjustedMoment.dayOfYear() / 7),
|
2041
|
+
year: adjustedMoment.year()
|
2042
|
+
};
|
2043
|
+
}
|
2044
|
+
|
2045
|
+
//http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
|
2046
|
+
function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) {
|
2047
|
+
var d = makeUTCDate(year, 0, 1).getUTCDay(), daysToAdd, dayOfYear;
|
2048
|
+
|
2049
|
+
d = d === 0 ? 7 : d;
|
2050
|
+
weekday = weekday != null ? weekday : firstDayOfWeek;
|
2051
|
+
daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0);
|
2052
|
+
dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1;
|
2053
|
+
|
2054
|
+
return {
|
2055
|
+
year: dayOfYear > 0 ? year : year - 1,
|
2056
|
+
dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear
|
2057
|
+
};
|
2058
|
+
}
|
2059
|
+
|
2060
|
+
/************************************
|
2061
|
+
Top Level Functions
|
2062
|
+
************************************/
|
2063
|
+
|
2064
|
+
function makeMoment(config) {
|
2065
|
+
var input = config._i,
|
2066
|
+
format = config._f;
|
2067
|
+
|
2068
|
+
config._locale = config._locale || moment.localeData(config._l);
|
2069
|
+
|
2070
|
+
if (input === null || (format === undefined && input === '')) {
|
2071
|
+
return moment.invalid({nullInput: true});
|
2072
|
+
}
|
2073
|
+
|
2074
|
+
if (typeof input === 'string') {
|
2075
|
+
config._i = input = config._locale.preparse(input);
|
2076
|
+
}
|
2077
|
+
|
2078
|
+
if (moment.isMoment(input)) {
|
2079
|
+
return new Moment(input, true);
|
2080
|
+
} else if (format) {
|
2081
|
+
if (isArray(format)) {
|
2082
|
+
makeDateFromStringAndArray(config);
|
2083
|
+
} else {
|
2084
|
+
makeDateFromStringAndFormat(config);
|
2085
|
+
}
|
2086
|
+
} else {
|
2087
|
+
makeDateFromInput(config);
|
2088
|
+
}
|
2089
|
+
|
2090
|
+
return new Moment(config);
|
2091
|
+
}
|
2092
|
+
|
2093
|
+
moment = function (input, format, locale, strict) {
|
2094
|
+
var c;
|
2095
|
+
|
2096
|
+
if (typeof(locale) === 'boolean') {
|
2097
|
+
strict = locale;
|
2098
|
+
locale = undefined;
|
2099
|
+
}
|
2100
|
+
// object construction must be done this way.
|
2101
|
+
// https://github.com/moment/moment/issues/1423
|
2102
|
+
c = {};
|
2103
|
+
c._isAMomentObject = true;
|
2104
|
+
c._i = input;
|
2105
|
+
c._f = format;
|
2106
|
+
c._l = locale;
|
2107
|
+
c._strict = strict;
|
2108
|
+
c._isUTC = false;
|
2109
|
+
c._pf = defaultParsingFlags();
|
2110
|
+
|
2111
|
+
return makeMoment(c);
|
2112
|
+
};
|
2113
|
+
|
2114
|
+
moment.suppressDeprecationWarnings = false;
|
2115
|
+
|
2116
|
+
moment.createFromInputFallback = deprecate(
|
2117
|
+
'moment construction falls back to js Date. This is ' +
|
2118
|
+
'discouraged and will be removed in upcoming major ' +
|
2119
|
+
'release. Please refer to ' +
|
2120
|
+
'https://github.com/moment/moment/issues/1407 for more info.',
|
2121
|
+
function (config) {
|
2122
|
+
config._d = new Date(config._i);
|
2123
|
+
}
|
2124
|
+
);
|
2125
|
+
|
2126
|
+
// Pick a moment m from moments so that m[fn](other) is true for all
|
2127
|
+
// other. This relies on the function fn to be transitive.
|
2128
|
+
//
|
2129
|
+
// moments should either be an array of moment objects or an array, whose
|
2130
|
+
// first element is an array of moment objects.
|
2131
|
+
function pickBy(fn, moments) {
|
2132
|
+
var res, i;
|
2133
|
+
if (moments.length === 1 && isArray(moments[0])) {
|
2134
|
+
moments = moments[0];
|
2135
|
+
}
|
2136
|
+
if (!moments.length) {
|
2137
|
+
return moment();
|
2138
|
+
}
|
2139
|
+
res = moments[0];
|
2140
|
+
for (i = 1; i < moments.length; ++i) {
|
2141
|
+
if (moments[i][fn](res)) {
|
2142
|
+
res = moments[i];
|
2143
|
+
}
|
2144
|
+
}
|
2145
|
+
return res;
|
2146
|
+
}
|
2147
|
+
|
2148
|
+
moment.min = function () {
|
2149
|
+
var args = [].slice.call(arguments, 0);
|
2150
|
+
|
2151
|
+
return pickBy('isBefore', args);
|
2152
|
+
};
|
2153
|
+
|
2154
|
+
moment.max = function () {
|
2155
|
+
var args = [].slice.call(arguments, 0);
|
2156
|
+
|
2157
|
+
return pickBy('isAfter', args);
|
2158
|
+
};
|
2159
|
+
|
2160
|
+
// creating with utc
|
2161
|
+
moment.utc = function (input, format, locale, strict) {
|
2162
|
+
var c;
|
2163
|
+
|
2164
|
+
if (typeof(locale) === 'boolean') {
|
2165
|
+
strict = locale;
|
2166
|
+
locale = undefined;
|
2167
|
+
}
|
2168
|
+
// object construction must be done this way.
|
2169
|
+
// https://github.com/moment/moment/issues/1423
|
2170
|
+
c = {};
|
2171
|
+
c._isAMomentObject = true;
|
2172
|
+
c._useUTC = true;
|
2173
|
+
c._isUTC = true;
|
2174
|
+
c._l = locale;
|
2175
|
+
c._i = input;
|
2176
|
+
c._f = format;
|
2177
|
+
c._strict = strict;
|
2178
|
+
c._pf = defaultParsingFlags();
|
2179
|
+
|
2180
|
+
return makeMoment(c).utc();
|
2181
|
+
};
|
2182
|
+
|
2183
|
+
// creating with unix timestamp (in seconds)
|
2184
|
+
moment.unix = function (input) {
|
2185
|
+
return moment(input * 1000);
|
2186
|
+
};
|
2187
|
+
|
2188
|
+
// duration
|
2189
|
+
moment.duration = function (input, key) {
|
2190
|
+
var duration = input,
|
2191
|
+
// matching against regexp is expensive, do it on demand
|
2192
|
+
match = null,
|
2193
|
+
sign,
|
2194
|
+
ret,
|
2195
|
+
parseIso,
|
2196
|
+
diffRes;
|
2197
|
+
|
2198
|
+
if (moment.isDuration(input)) {
|
2199
|
+
duration = {
|
2200
|
+
ms: input._milliseconds,
|
2201
|
+
d: input._days,
|
2202
|
+
M: input._months
|
2203
|
+
};
|
2204
|
+
} else if (typeof input === 'number') {
|
2205
|
+
duration = {};
|
2206
|
+
if (key) {
|
2207
|
+
duration[key] = input;
|
2208
|
+
} else {
|
2209
|
+
duration.milliseconds = input;
|
2210
|
+
}
|
2211
|
+
} else if (!!(match = aspNetTimeSpanJsonRegex.exec(input))) {
|
2212
|
+
sign = (match[1] === '-') ? -1 : 1;
|
2213
|
+
duration = {
|
2214
|
+
y: 0,
|
2215
|
+
d: toInt(match[DATE]) * sign,
|
2216
|
+
h: toInt(match[HOUR]) * sign,
|
2217
|
+
m: toInt(match[MINUTE]) * sign,
|
2218
|
+
s: toInt(match[SECOND]) * sign,
|
2219
|
+
ms: toInt(match[MILLISECOND]) * sign
|
2220
|
+
};
|
2221
|
+
} else if (!!(match = isoDurationRegex.exec(input))) {
|
2222
|
+
sign = (match[1] === '-') ? -1 : 1;
|
2223
|
+
parseIso = function (inp) {
|
2224
|
+
// We'd normally use ~~inp for this, but unfortunately it also
|
2225
|
+
// converts floats to ints.
|
2226
|
+
// inp may be undefined, so careful calling replace on it.
|
2227
|
+
var res = inp && parseFloat(inp.replace(',', '.'));
|
2228
|
+
// apply sign while we're at it
|
2229
|
+
return (isNaN(res) ? 0 : res) * sign;
|
2230
|
+
};
|
2231
|
+
duration = {
|
2232
|
+
y: parseIso(match[2]),
|
2233
|
+
M: parseIso(match[3]),
|
2234
|
+
d: parseIso(match[4]),
|
2235
|
+
h: parseIso(match[5]),
|
2236
|
+
m: parseIso(match[6]),
|
2237
|
+
s: parseIso(match[7]),
|
2238
|
+
w: parseIso(match[8])
|
2239
|
+
};
|
2240
|
+
} else if (typeof duration === 'object' &&
|
2241
|
+
('from' in duration || 'to' in duration)) {
|
2242
|
+
diffRes = momentsDifference(moment(duration.from), moment(duration.to));
|
2243
|
+
|
2244
|
+
duration = {};
|
2245
|
+
duration.ms = diffRes.milliseconds;
|
2246
|
+
duration.M = diffRes.months;
|
2247
|
+
}
|
2248
|
+
|
2249
|
+
ret = new Duration(duration);
|
2250
|
+
|
2251
|
+
if (moment.isDuration(input) && hasOwnProp(input, '_locale')) {
|
2252
|
+
ret._locale = input._locale;
|
2253
|
+
}
|
2254
|
+
|
2255
|
+
return ret;
|
2256
|
+
};
|
2257
|
+
|
2258
|
+
// version number
|
2259
|
+
moment.version = VERSION;
|
2260
|
+
|
2261
|
+
// default format
|
2262
|
+
moment.defaultFormat = isoFormat;
|
2263
|
+
|
2264
|
+
// constant that refers to the ISO standard
|
2265
|
+
moment.ISO_8601 = function () {};
|
2266
|
+
|
2267
|
+
// Plugins that add properties should also add the key here (null value),
|
2268
|
+
// so we can properly clone ourselves.
|
2269
|
+
moment.momentProperties = momentProperties;
|
2270
|
+
|
2271
|
+
// This function will be called whenever a moment is mutated.
|
2272
|
+
// It is intended to keep the offset in sync with the timezone.
|
2273
|
+
moment.updateOffset = function () {};
|
2274
|
+
|
2275
|
+
// This function allows you to set a threshold for relative time strings
|
2276
|
+
moment.relativeTimeThreshold = function (threshold, limit) {
|
2277
|
+
if (relativeTimeThresholds[threshold] === undefined) {
|
2278
|
+
return false;
|
2279
|
+
}
|
2280
|
+
if (limit === undefined) {
|
2281
|
+
return relativeTimeThresholds[threshold];
|
2282
|
+
}
|
2283
|
+
relativeTimeThresholds[threshold] = limit;
|
2284
|
+
return true;
|
2285
|
+
};
|
2286
|
+
|
2287
|
+
moment.lang = deprecate(
|
2288
|
+
'moment.lang is deprecated. Use moment.locale instead.',
|
2289
|
+
function (key, value) {
|
2290
|
+
return moment.locale(key, value);
|
2291
|
+
}
|
2292
|
+
);
|
2293
|
+
|
2294
|
+
// This function will load locale and then set the global locale. If
|
2295
|
+
// no arguments are passed in, it will simply return the current global
|
2296
|
+
// locale key.
|
2297
|
+
moment.locale = function (key, values) {
|
2298
|
+
var data;
|
2299
|
+
if (key) {
|
2300
|
+
if (typeof(values) !== 'undefined') {
|
2301
|
+
data = moment.defineLocale(key, values);
|
2302
|
+
}
|
2303
|
+
else {
|
2304
|
+
data = moment.localeData(key);
|
2305
|
+
}
|
2306
|
+
|
2307
|
+
if (data) {
|
2308
|
+
moment.duration._locale = moment._locale = data;
|
2309
|
+
}
|
2310
|
+
}
|
2311
|
+
|
2312
|
+
return moment._locale._abbr;
|
2313
|
+
};
|
2314
|
+
|
2315
|
+
moment.defineLocale = function (name, values) {
|
2316
|
+
if (values !== null) {
|
2317
|
+
values.abbr = name;
|
2318
|
+
if (!locales[name]) {
|
2319
|
+
locales[name] = new Locale();
|
2320
|
+
}
|
2321
|
+
locales[name].set(values);
|
2322
|
+
|
2323
|
+
// backwards compat for now: also set the locale
|
2324
|
+
moment.locale(name);
|
2325
|
+
|
2326
|
+
return locales[name];
|
2327
|
+
} else {
|
2328
|
+
// useful for testing
|
2329
|
+
delete locales[name];
|
2330
|
+
return null;
|
2331
|
+
}
|
2332
|
+
};
|
2333
|
+
|
2334
|
+
moment.langData = deprecate(
|
2335
|
+
'moment.langData is deprecated. Use moment.localeData instead.',
|
2336
|
+
function (key) {
|
2337
|
+
return moment.localeData(key);
|
2338
|
+
}
|
2339
|
+
);
|
2340
|
+
|
2341
|
+
// returns locale data
|
2342
|
+
moment.localeData = function (key) {
|
2343
|
+
var locale;
|
2344
|
+
|
2345
|
+
if (key && key._locale && key._locale._abbr) {
|
2346
|
+
key = key._locale._abbr;
|
2347
|
+
}
|
2348
|
+
|
2349
|
+
if (!key) {
|
2350
|
+
return moment._locale;
|
2351
|
+
}
|
2352
|
+
|
2353
|
+
if (!isArray(key)) {
|
2354
|
+
//short-circuit everything else
|
2355
|
+
locale = loadLocale(key);
|
2356
|
+
if (locale) {
|
2357
|
+
return locale;
|
2358
|
+
}
|
2359
|
+
key = [key];
|
2360
|
+
}
|
2361
|
+
|
2362
|
+
return chooseLocale(key);
|
2363
|
+
};
|
2364
|
+
|
2365
|
+
// compare moment object
|
2366
|
+
moment.isMoment = function (obj) {
|
2367
|
+
return obj instanceof Moment ||
|
2368
|
+
(obj != null && hasOwnProp(obj, '_isAMomentObject'));
|
2369
|
+
};
|
2370
|
+
|
2371
|
+
// for typechecking Duration objects
|
2372
|
+
moment.isDuration = function (obj) {
|
2373
|
+
return obj instanceof Duration;
|
2374
|
+
};
|
2375
|
+
|
2376
|
+
for (i = lists.length - 1; i >= 0; --i) {
|
2377
|
+
makeList(lists[i]);
|
2378
|
+
}
|
2379
|
+
|
2380
|
+
moment.normalizeUnits = function (units) {
|
2381
|
+
return normalizeUnits(units);
|
2382
|
+
};
|
2383
|
+
|
2384
|
+
moment.invalid = function (flags) {
|
2385
|
+
var m = moment.utc(NaN);
|
2386
|
+
if (flags != null) {
|
2387
|
+
extend(m._pf, flags);
|
2388
|
+
}
|
2389
|
+
else {
|
2390
|
+
m._pf.userInvalidated = true;
|
2391
|
+
}
|
2392
|
+
|
2393
|
+
return m;
|
2394
|
+
};
|
2395
|
+
|
2396
|
+
moment.parseZone = function () {
|
2397
|
+
return moment.apply(null, arguments).parseZone();
|
2398
|
+
};
|
2399
|
+
|
2400
|
+
moment.parseTwoDigitYear = function (input) {
|
2401
|
+
return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
|
2402
|
+
};
|
2403
|
+
|
2404
|
+
/************************************
|
2405
|
+
Moment Prototype
|
2406
|
+
************************************/
|
2407
|
+
|
2408
|
+
|
2409
|
+
extend(moment.fn = Moment.prototype, {
|
2410
|
+
|
2411
|
+
clone : function () {
|
2412
|
+
return moment(this);
|
2413
|
+
},
|
2414
|
+
|
2415
|
+
valueOf : function () {
|
2416
|
+
return +this._d + ((this._offset || 0) * 60000);
|
2417
|
+
},
|
2418
|
+
|
2419
|
+
unix : function () {
|
2420
|
+
return Math.floor(+this / 1000);
|
2421
|
+
},
|
2422
|
+
|
2423
|
+
toString : function () {
|
2424
|
+
return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
|
2425
|
+
},
|
2426
|
+
|
2427
|
+
toDate : function () {
|
2428
|
+
return this._offset ? new Date(+this) : this._d;
|
2429
|
+
},
|
2430
|
+
|
2431
|
+
toISOString : function () {
|
2432
|
+
var m = moment(this).utc();
|
2433
|
+
if (0 < m.year() && m.year() <= 9999) {
|
2434
|
+
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
2435
|
+
} else {
|
2436
|
+
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
|
2437
|
+
}
|
2438
|
+
},
|
2439
|
+
|
2440
|
+
toArray : function () {
|
2441
|
+
var m = this;
|
2442
|
+
return [
|
2443
|
+
m.year(),
|
2444
|
+
m.month(),
|
2445
|
+
m.date(),
|
2446
|
+
m.hours(),
|
2447
|
+
m.minutes(),
|
2448
|
+
m.seconds(),
|
2449
|
+
m.milliseconds()
|
2450
|
+
];
|
2451
|
+
},
|
2452
|
+
|
2453
|
+
isValid : function () {
|
2454
|
+
return isValid(this);
|
2455
|
+
},
|
2456
|
+
|
2457
|
+
isDSTShifted : function () {
|
2458
|
+
if (this._a) {
|
2459
|
+
return this.isValid() && compareArrays(this._a, (this._isUTC ? moment.utc(this._a) : moment(this._a)).toArray()) > 0;
|
2460
|
+
}
|
2461
|
+
|
2462
|
+
return false;
|
2463
|
+
},
|
2464
|
+
|
2465
|
+
parsingFlags : function () {
|
2466
|
+
return extend({}, this._pf);
|
2467
|
+
},
|
2468
|
+
|
2469
|
+
invalidAt: function () {
|
2470
|
+
return this._pf.overflow;
|
2471
|
+
},
|
2472
|
+
|
2473
|
+
utc : function (keepLocalTime) {
|
2474
|
+
return this.zone(0, keepLocalTime);
|
2475
|
+
},
|
2476
|
+
|
2477
|
+
local : function (keepLocalTime) {
|
2478
|
+
if (this._isUTC) {
|
2479
|
+
this.zone(0, keepLocalTime);
|
2480
|
+
this._isUTC = false;
|
2481
|
+
|
2482
|
+
if (keepLocalTime) {
|
2483
|
+
this.add(this._dateTzOffset(), 'm');
|
2484
|
+
}
|
2485
|
+
}
|
2486
|
+
return this;
|
2487
|
+
},
|
2488
|
+
|
2489
|
+
format : function (inputString) {
|
2490
|
+
var output = formatMoment(this, inputString || moment.defaultFormat);
|
2491
|
+
return this.localeData().postformat(output);
|
2492
|
+
},
|
2493
|
+
|
2494
|
+
add : createAdder(1, 'add'),
|
2495
|
+
|
2496
|
+
subtract : createAdder(-1, 'subtract'),
|
2497
|
+
|
2498
|
+
diff : function (input, units, asFloat) {
|
2499
|
+
var that = makeAs(input, this),
|
2500
|
+
zoneDiff = (this.zone() - that.zone()) * 6e4,
|
2501
|
+
diff, output, daysAdjust;
|
2502
|
+
|
2503
|
+
units = normalizeUnits(units);
|
2504
|
+
|
2505
|
+
if (units === 'year' || units === 'month') {
|
2506
|
+
// average number of days in the months in the given dates
|
2507
|
+
diff = (this.daysInMonth() + that.daysInMonth()) * 432e5; // 24 * 60 * 60 * 1000 / 2
|
2508
|
+
// difference in months
|
2509
|
+
output = ((this.year() - that.year()) * 12) + (this.month() - that.month());
|
2510
|
+
// adjust by taking difference in days, average number of days
|
2511
|
+
// and dst in the given months.
|
2512
|
+
daysAdjust = (this - moment(this).startOf('month')) -
|
2513
|
+
(that - moment(that).startOf('month'));
|
2514
|
+
// same as above but with zones, to negate all dst
|
2515
|
+
daysAdjust -= ((this.zone() - moment(this).startOf('month').zone()) -
|
2516
|
+
(that.zone() - moment(that).startOf('month').zone())) * 6e4;
|
2517
|
+
output += daysAdjust / diff;
|
2518
|
+
if (units === 'year') {
|
2519
|
+
output = output / 12;
|
2520
|
+
}
|
2521
|
+
} else {
|
2522
|
+
diff = (this - that);
|
2523
|
+
output = units === 'second' ? diff / 1e3 : // 1000
|
2524
|
+
units === 'minute' ? diff / 6e4 : // 1000 * 60
|
2525
|
+
units === 'hour' ? diff / 36e5 : // 1000 * 60 * 60
|
2526
|
+
units === 'day' ? (diff - zoneDiff) / 864e5 : // 1000 * 60 * 60 * 24, negate dst
|
2527
|
+
units === 'week' ? (diff - zoneDiff) / 6048e5 : // 1000 * 60 * 60 * 24 * 7, negate dst
|
2528
|
+
diff;
|
2529
|
+
}
|
2530
|
+
return asFloat ? output : absRound(output);
|
2531
|
+
},
|
2532
|
+
|
2533
|
+
from : function (time, withoutSuffix) {
|
2534
|
+
return moment.duration({to: this, from: time}).locale(this.locale()).humanize(!withoutSuffix);
|
2535
|
+
},
|
2536
|
+
|
2537
|
+
fromNow : function (withoutSuffix) {
|
2538
|
+
return this.from(moment(), withoutSuffix);
|
2539
|
+
},
|
2540
|
+
|
2541
|
+
calendar : function (time) {
|
2542
|
+
// We want to compare the start of today, vs this.
|
2543
|
+
// Getting start-of-today depends on whether we're zone'd or not.
|
2544
|
+
var now = time || moment(),
|
2545
|
+
sod = makeAs(now, this).startOf('day'),
|
2546
|
+
diff = this.diff(sod, 'days', true),
|
2547
|
+
format = diff < -6 ? 'sameElse' :
|
2548
|
+
diff < -1 ? 'lastWeek' :
|
2549
|
+
diff < 0 ? 'lastDay' :
|
2550
|
+
diff < 1 ? 'sameDay' :
|
2551
|
+
diff < 2 ? 'nextDay' :
|
2552
|
+
diff < 7 ? 'nextWeek' : 'sameElse';
|
2553
|
+
return this.format(this.localeData().calendar(format, this));
|
2554
|
+
},
|
2555
|
+
|
2556
|
+
isLeapYear : function () {
|
2557
|
+
return isLeapYear(this.year());
|
2558
|
+
},
|
2559
|
+
|
2560
|
+
isDST : function () {
|
2561
|
+
return (this.zone() < this.clone().month(0).zone() ||
|
2562
|
+
this.zone() < this.clone().month(5).zone());
|
2563
|
+
},
|
2564
|
+
|
2565
|
+
day : function (input) {
|
2566
|
+
var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
|
2567
|
+
if (input != null) {
|
2568
|
+
input = parseWeekday(input, this.localeData());
|
2569
|
+
return this.add(input - day, 'd');
|
2570
|
+
} else {
|
2571
|
+
return day;
|
2572
|
+
}
|
2573
|
+
},
|
2574
|
+
|
2575
|
+
month : makeAccessor('Month', true),
|
2576
|
+
|
2577
|
+
startOf : function (units) {
|
2578
|
+
units = normalizeUnits(units);
|
2579
|
+
// the following switch intentionally omits break keywords
|
2580
|
+
// to utilize falling through the cases.
|
2581
|
+
switch (units) {
|
2582
|
+
case 'year':
|
2583
|
+
this.month(0);
|
2584
|
+
/* falls through */
|
2585
|
+
case 'quarter':
|
2586
|
+
case 'month':
|
2587
|
+
this.date(1);
|
2588
|
+
/* falls through */
|
2589
|
+
case 'week':
|
2590
|
+
case 'isoWeek':
|
2591
|
+
case 'day':
|
2592
|
+
this.hours(0);
|
2593
|
+
/* falls through */
|
2594
|
+
case 'hour':
|
2595
|
+
this.minutes(0);
|
2596
|
+
/* falls through */
|
2597
|
+
case 'minute':
|
2598
|
+
this.seconds(0);
|
2599
|
+
/* falls through */
|
2600
|
+
case 'second':
|
2601
|
+
this.milliseconds(0);
|
2602
|
+
/* falls through */
|
2603
|
+
}
|
2604
|
+
|
2605
|
+
// weeks are a special case
|
2606
|
+
if (units === 'week') {
|
2607
|
+
this.weekday(0);
|
2608
|
+
} else if (units === 'isoWeek') {
|
2609
|
+
this.isoWeekday(1);
|
2610
|
+
}
|
2611
|
+
|
2612
|
+
// quarters are also special
|
2613
|
+
if (units === 'quarter') {
|
2614
|
+
this.month(Math.floor(this.month() / 3) * 3);
|
2615
|
+
}
|
2616
|
+
|
2617
|
+
return this;
|
2618
|
+
},
|
2619
|
+
|
2620
|
+
endOf: function (units) {
|
2621
|
+
units = normalizeUnits(units);
|
2622
|
+
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
|
2623
|
+
},
|
2624
|
+
|
2625
|
+
isAfter: function (input, units) {
|
2626
|
+
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
2627
|
+
if (units === 'millisecond') {
|
2628
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2629
|
+
return +this > +input;
|
2630
|
+
} else {
|
2631
|
+
return +this.clone().startOf(units) > +moment(input).startOf(units);
|
2632
|
+
}
|
2633
|
+
},
|
2634
|
+
|
2635
|
+
isBefore: function (input, units) {
|
2636
|
+
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
|
2637
|
+
if (units === 'millisecond') {
|
2638
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2639
|
+
return +this < +input;
|
2640
|
+
} else {
|
2641
|
+
return +this.clone().startOf(units) < +moment(input).startOf(units);
|
2642
|
+
}
|
2643
|
+
},
|
2644
|
+
|
2645
|
+
isSame: function (input, units) {
|
2646
|
+
units = normalizeUnits(units || 'millisecond');
|
2647
|
+
if (units === 'millisecond') {
|
2648
|
+
input = moment.isMoment(input) ? input : moment(input);
|
2649
|
+
return +this === +input;
|
2650
|
+
} else {
|
2651
|
+
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
|
2652
|
+
}
|
2653
|
+
},
|
2654
|
+
|
2655
|
+
min: deprecate(
|
2656
|
+
'moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548',
|
2657
|
+
function (other) {
|
2658
|
+
other = moment.apply(null, arguments);
|
2659
|
+
return other < this ? this : other;
|
2660
|
+
}
|
2661
|
+
),
|
2662
|
+
|
2663
|
+
max: deprecate(
|
2664
|
+
'moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548',
|
2665
|
+
function (other) {
|
2666
|
+
other = moment.apply(null, arguments);
|
2667
|
+
return other > this ? this : other;
|
2668
|
+
}
|
2669
|
+
),
|
2670
|
+
|
2671
|
+
// keepLocalTime = true means only change the timezone, without
|
2672
|
+
// affecting the local hour. So 5:31:26 +0300 --[zone(2, true)]-->
|
2673
|
+
// 5:31:26 +0200 It is possible that 5:31:26 doesn't exist int zone
|
2674
|
+
// +0200, so we adjust the time as needed, to be valid.
|
2675
|
+
//
|
2676
|
+
// Keeping the time actually adds/subtracts (one hour)
|
2677
|
+
// from the actual represented time. That is why we call updateOffset
|
2678
|
+
// a second time. In case it wants us to change the offset again
|
2679
|
+
// _changeInProgress == true case, then we have to adjust, because
|
2680
|
+
// there is no such time in the given timezone.
|
2681
|
+
zone : function (input, keepLocalTime) {
|
2682
|
+
var offset = this._offset || 0,
|
2683
|
+
localAdjust;
|
2684
|
+
if (input != null) {
|
2685
|
+
if (typeof input === 'string') {
|
2686
|
+
input = timezoneMinutesFromString(input);
|
2687
|
+
}
|
2688
|
+
if (Math.abs(input) < 16) {
|
2689
|
+
input = input * 60;
|
2690
|
+
}
|
2691
|
+
if (!this._isUTC && keepLocalTime) {
|
2692
|
+
localAdjust = this._dateTzOffset();
|
2693
|
+
}
|
2694
|
+
this._offset = input;
|
2695
|
+
this._isUTC = true;
|
2696
|
+
if (localAdjust != null) {
|
2697
|
+
this.subtract(localAdjust, 'm');
|
2698
|
+
}
|
2699
|
+
if (offset !== input) {
|
2700
|
+
if (!keepLocalTime || this._changeInProgress) {
|
2701
|
+
addOrSubtractDurationFromMoment(this,
|
2702
|
+
moment.duration(offset - input, 'm'), 1, false);
|
2703
|
+
} else if (!this._changeInProgress) {
|
2704
|
+
this._changeInProgress = true;
|
2705
|
+
moment.updateOffset(this, true);
|
2706
|
+
this._changeInProgress = null;
|
2707
|
+
}
|
2708
|
+
}
|
2709
|
+
} else {
|
2710
|
+
return this._isUTC ? offset : this._dateTzOffset();
|
2711
|
+
}
|
2712
|
+
return this;
|
2713
|
+
},
|
2714
|
+
|
2715
|
+
zoneAbbr : function () {
|
2716
|
+
return this._isUTC ? 'UTC' : '';
|
2717
|
+
},
|
2718
|
+
|
2719
|
+
zoneName : function () {
|
2720
|
+
return this._isUTC ? 'Coordinated Universal Time' : '';
|
2721
|
+
},
|
2722
|
+
|
2723
|
+
parseZone : function () {
|
2724
|
+
if (this._tzm) {
|
2725
|
+
this.zone(this._tzm);
|
2726
|
+
} else if (typeof this._i === 'string') {
|
2727
|
+
this.zone(this._i);
|
2728
|
+
}
|
2729
|
+
return this;
|
2730
|
+
},
|
2731
|
+
|
2732
|
+
hasAlignedHourOffset : function (input) {
|
2733
|
+
if (!input) {
|
2734
|
+
input = 0;
|
2735
|
+
}
|
2736
|
+
else {
|
2737
|
+
input = moment(input).zone();
|
2738
|
+
}
|
2739
|
+
|
2740
|
+
return (this.zone() - input) % 60 === 0;
|
2741
|
+
},
|
2742
|
+
|
2743
|
+
daysInMonth : function () {
|
2744
|
+
return daysInMonth(this.year(), this.month());
|
2745
|
+
},
|
2746
|
+
|
2747
|
+
dayOfYear : function (input) {
|
2748
|
+
var dayOfYear = round((moment(this).startOf('day') - moment(this).startOf('year')) / 864e5) + 1;
|
2749
|
+
return input == null ? dayOfYear : this.add((input - dayOfYear), 'd');
|
2750
|
+
},
|
2751
|
+
|
2752
|
+
quarter : function (input) {
|
2753
|
+
return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3);
|
2754
|
+
},
|
2755
|
+
|
2756
|
+
weekYear : function (input) {
|
2757
|
+
var year = weekOfYear(this, this.localeData()._week.dow, this.localeData()._week.doy).year;
|
2758
|
+
return input == null ? year : this.add((input - year), 'y');
|
2759
|
+
},
|
2760
|
+
|
2761
|
+
isoWeekYear : function (input) {
|
2762
|
+
var year = weekOfYear(this, 1, 4).year;
|
2763
|
+
return input == null ? year : this.add((input - year), 'y');
|
2764
|
+
},
|
2765
|
+
|
2766
|
+
week : function (input) {
|
2767
|
+
var week = this.localeData().week(this);
|
2768
|
+
return input == null ? week : this.add((input - week) * 7, 'd');
|
2769
|
+
},
|
2770
|
+
|
2771
|
+
isoWeek : function (input) {
|
2772
|
+
var week = weekOfYear(this, 1, 4).week;
|
2773
|
+
return input == null ? week : this.add((input - week) * 7, 'd');
|
2774
|
+
},
|
2775
|
+
|
2776
|
+
weekday : function (input) {
|
2777
|
+
var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
|
2778
|
+
return input == null ? weekday : this.add(input - weekday, 'd');
|
2779
|
+
},
|
2780
|
+
|
2781
|
+
isoWeekday : function (input) {
|
2782
|
+
// behaves the same as moment#day except
|
2783
|
+
// as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
|
2784
|
+
// as a setter, sunday should belong to the previous week.
|
2785
|
+
return input == null ? this.day() || 7 : this.day(this.day() % 7 ? input : input - 7);
|
2786
|
+
},
|
2787
|
+
|
2788
|
+
isoWeeksInYear : function () {
|
2789
|
+
return weeksInYear(this.year(), 1, 4);
|
2790
|
+
},
|
2791
|
+
|
2792
|
+
weeksInYear : function () {
|
2793
|
+
var weekInfo = this.localeData()._week;
|
2794
|
+
return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
|
2795
|
+
},
|
2796
|
+
|
2797
|
+
get : function (units) {
|
2798
|
+
units = normalizeUnits(units);
|
2799
|
+
return this[units]();
|
2800
|
+
},
|
2801
|
+
|
2802
|
+
set : function (units, value) {
|
2803
|
+
units = normalizeUnits(units);
|
2804
|
+
if (typeof this[units] === 'function') {
|
2805
|
+
this[units](value);
|
2806
|
+
}
|
2807
|
+
return this;
|
2808
|
+
},
|
2809
|
+
|
2810
|
+
// If passed a locale key, it will set the locale for this
|
2811
|
+
// instance. Otherwise, it will return the locale configuration
|
2812
|
+
// variables for this instance.
|
2813
|
+
locale : function (key) {
|
2814
|
+
var newLocaleData;
|
2815
|
+
|
2816
|
+
if (key === undefined) {
|
2817
|
+
return this._locale._abbr;
|
2818
|
+
} else {
|
2819
|
+
newLocaleData = moment.localeData(key);
|
2820
|
+
if (newLocaleData != null) {
|
2821
|
+
this._locale = newLocaleData;
|
2822
|
+
}
|
2823
|
+
return this;
|
2824
|
+
}
|
2825
|
+
},
|
2826
|
+
|
2827
|
+
lang : deprecate(
|
2828
|
+
'moment().lang() is deprecated. Use moment().localeData() instead.',
|
2829
|
+
function (key) {
|
2830
|
+
if (key === undefined) {
|
2831
|
+
return this.localeData();
|
2832
|
+
} else {
|
2833
|
+
return this.locale(key);
|
2834
|
+
}
|
2835
|
+
}
|
2836
|
+
),
|
2837
|
+
|
2838
|
+
localeData : function () {
|
2839
|
+
return this._locale;
|
2840
|
+
},
|
2841
|
+
|
2842
|
+
_dateTzOffset : function () {
|
2843
|
+
// On Firefox.24 Date#getTimezoneOffset returns a floating point.
|
2844
|
+
// https://github.com/moment/moment/pull/1871
|
2845
|
+
return Math.round(this._d.getTimezoneOffset() / 15) * 15;
|
2846
|
+
}
|
2847
|
+
});
|
2848
|
+
|
2849
|
+
function rawMonthSetter(mom, value) {
|
2850
|
+
var dayOfMonth;
|
2851
|
+
|
2852
|
+
// TODO: Move this out of here!
|
2853
|
+
if (typeof value === 'string') {
|
2854
|
+
value = mom.localeData().monthsParse(value);
|
2855
|
+
// TODO: Another silent failure?
|
2856
|
+
if (typeof value !== 'number') {
|
2857
|
+
return mom;
|
2858
|
+
}
|
2859
|
+
}
|
2860
|
+
|
2861
|
+
dayOfMonth = Math.min(mom.date(),
|
2862
|
+
daysInMonth(mom.year(), value));
|
2863
|
+
mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
|
2864
|
+
return mom;
|
2865
|
+
}
|
2866
|
+
|
2867
|
+
function rawGetter(mom, unit) {
|
2868
|
+
return mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]();
|
2869
|
+
}
|
2870
|
+
|
2871
|
+
function rawSetter(mom, unit, value) {
|
2872
|
+
if (unit === 'Month') {
|
2873
|
+
return rawMonthSetter(mom, value);
|
2874
|
+
} else {
|
2875
|
+
return mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
|
2876
|
+
}
|
2877
|
+
}
|
2878
|
+
|
2879
|
+
function makeAccessor(unit, keepTime) {
|
2880
|
+
return function (value) {
|
2881
|
+
if (value != null) {
|
2882
|
+
rawSetter(this, unit, value);
|
2883
|
+
moment.updateOffset(this, keepTime);
|
2884
|
+
return this;
|
2885
|
+
} else {
|
2886
|
+
return rawGetter(this, unit);
|
2887
|
+
}
|
2888
|
+
};
|
2889
|
+
}
|
2890
|
+
|
2891
|
+
moment.fn.millisecond = moment.fn.milliseconds = makeAccessor('Milliseconds', false);
|
2892
|
+
moment.fn.second = moment.fn.seconds = makeAccessor('Seconds', false);
|
2893
|
+
moment.fn.minute = moment.fn.minutes = makeAccessor('Minutes', false);
|
2894
|
+
// Setting the hour should keep the time, because the user explicitly
|
2895
|
+
// specified which hour he wants. So trying to maintain the same hour (in
|
2896
|
+
// a new timezone) makes sense. Adding/subtracting hours does not follow
|
2897
|
+
// this rule.
|
2898
|
+
moment.fn.hour = moment.fn.hours = makeAccessor('Hours', true);
|
2899
|
+
// moment.fn.month is defined separately
|
2900
|
+
moment.fn.date = makeAccessor('Date', true);
|
2901
|
+
moment.fn.dates = deprecate('dates accessor is deprecated. Use date instead.', makeAccessor('Date', true));
|
2902
|
+
moment.fn.year = makeAccessor('FullYear', true);
|
2903
|
+
moment.fn.years = deprecate('years accessor is deprecated. Use year instead.', makeAccessor('FullYear', true));
|
2904
|
+
|
2905
|
+
// add plural methods
|
2906
|
+
moment.fn.days = moment.fn.day;
|
2907
|
+
moment.fn.months = moment.fn.month;
|
2908
|
+
moment.fn.weeks = moment.fn.week;
|
2909
|
+
moment.fn.isoWeeks = moment.fn.isoWeek;
|
2910
|
+
moment.fn.quarters = moment.fn.quarter;
|
2911
|
+
|
2912
|
+
// add aliased format methods
|
2913
|
+
moment.fn.toJSON = moment.fn.toISOString;
|
2914
|
+
|
2915
|
+
/************************************
|
2916
|
+
Duration Prototype
|
2917
|
+
************************************/
|
2918
|
+
|
2919
|
+
|
2920
|
+
function daysToYears (days) {
|
2921
|
+
// 400 years have 146097 days (taking into account leap year rules)
|
2922
|
+
return days * 400 / 146097;
|
2923
|
+
}
|
2924
|
+
|
2925
|
+
function yearsToDays (years) {
|
2926
|
+
// years * 365 + absRound(years / 4) -
|
2927
|
+
// absRound(years / 100) + absRound(years / 400);
|
2928
|
+
return years * 146097 / 400;
|
2929
|
+
}
|
2930
|
+
|
2931
|
+
extend(moment.duration.fn = Duration.prototype, {
|
2932
|
+
|
2933
|
+
_bubble : function () {
|
2934
|
+
var milliseconds = this._milliseconds,
|
2935
|
+
days = this._days,
|
2936
|
+
months = this._months,
|
2937
|
+
data = this._data,
|
2938
|
+
seconds, minutes, hours, years = 0;
|
2939
|
+
|
2940
|
+
// The following code bubbles up values, see the tests for
|
2941
|
+
// examples of what that means.
|
2942
|
+
data.milliseconds = milliseconds % 1000;
|
2943
|
+
|
2944
|
+
seconds = absRound(milliseconds / 1000);
|
2945
|
+
data.seconds = seconds % 60;
|
2946
|
+
|
2947
|
+
minutes = absRound(seconds / 60);
|
2948
|
+
data.minutes = minutes % 60;
|
2949
|
+
|
2950
|
+
hours = absRound(minutes / 60);
|
2951
|
+
data.hours = hours % 24;
|
2952
|
+
|
2953
|
+
days += absRound(hours / 24);
|
2954
|
+
|
2955
|
+
// Accurately convert days to years, assume start from year 0.
|
2956
|
+
years = absRound(daysToYears(days));
|
2957
|
+
days -= absRound(yearsToDays(years));
|
2958
|
+
|
2959
|
+
// 30 days to a month
|
2960
|
+
// TODO (iskren): Use anchor date (like 1st Jan) to compute this.
|
2961
|
+
months += absRound(days / 30);
|
2962
|
+
days %= 30;
|
2963
|
+
|
2964
|
+
// 12 months -> 1 year
|
2965
|
+
years += absRound(months / 12);
|
2966
|
+
months %= 12;
|
2967
|
+
|
2968
|
+
data.days = days;
|
2969
|
+
data.months = months;
|
2970
|
+
data.years = years;
|
2971
|
+
},
|
2972
|
+
|
2973
|
+
abs : function () {
|
2974
|
+
this._milliseconds = Math.abs(this._milliseconds);
|
2975
|
+
this._days = Math.abs(this._days);
|
2976
|
+
this._months = Math.abs(this._months);
|
2977
|
+
|
2978
|
+
this._data.milliseconds = Math.abs(this._data.milliseconds);
|
2979
|
+
this._data.seconds = Math.abs(this._data.seconds);
|
2980
|
+
this._data.minutes = Math.abs(this._data.minutes);
|
2981
|
+
this._data.hours = Math.abs(this._data.hours);
|
2982
|
+
this._data.months = Math.abs(this._data.months);
|
2983
|
+
this._data.years = Math.abs(this._data.years);
|
2984
|
+
|
2985
|
+
return this;
|
2986
|
+
},
|
2987
|
+
|
2988
|
+
weeks : function () {
|
2989
|
+
return absRound(this.days() / 7);
|
2990
|
+
},
|
2991
|
+
|
2992
|
+
valueOf : function () {
|
2993
|
+
return this._milliseconds +
|
2994
|
+
this._days * 864e5 +
|
2995
|
+
(this._months % 12) * 2592e6 +
|
2996
|
+
toInt(this._months / 12) * 31536e6;
|
2997
|
+
},
|
2998
|
+
|
2999
|
+
humanize : function (withSuffix) {
|
3000
|
+
var output = relativeTime(this, !withSuffix, this.localeData());
|
3001
|
+
|
3002
|
+
if (withSuffix) {
|
3003
|
+
output = this.localeData().pastFuture(+this, output);
|
3004
|
+
}
|
3005
|
+
|
3006
|
+
return this.localeData().postformat(output);
|
3007
|
+
},
|
3008
|
+
|
3009
|
+
add : function (input, val) {
|
3010
|
+
// supports only 2.0-style add(1, 's') or add(moment)
|
3011
|
+
var dur = moment.duration(input, val);
|
3012
|
+
|
3013
|
+
this._milliseconds += dur._milliseconds;
|
3014
|
+
this._days += dur._days;
|
3015
|
+
this._months += dur._months;
|
3016
|
+
|
3017
|
+
this._bubble();
|
3018
|
+
|
3019
|
+
return this;
|
3020
|
+
},
|
3021
|
+
|
3022
|
+
subtract : function (input, val) {
|
3023
|
+
var dur = moment.duration(input, val);
|
3024
|
+
|
3025
|
+
this._milliseconds -= dur._milliseconds;
|
3026
|
+
this._days -= dur._days;
|
3027
|
+
this._months -= dur._months;
|
3028
|
+
|
3029
|
+
this._bubble();
|
3030
|
+
|
3031
|
+
return this;
|
3032
|
+
},
|
3033
|
+
|
3034
|
+
get : function (units) {
|
3035
|
+
units = normalizeUnits(units);
|
3036
|
+
return this[units.toLowerCase() + 's']();
|
3037
|
+
},
|
3038
|
+
|
3039
|
+
as : function (units) {
|
3040
|
+
var days, months;
|
3041
|
+
units = normalizeUnits(units);
|
3042
|
+
|
3043
|
+
if (units === 'month' || units === 'year') {
|
3044
|
+
days = this._days + this._milliseconds / 864e5;
|
3045
|
+
months = this._months + daysToYears(days) * 12;
|
3046
|
+
return units === 'month' ? months : months / 12;
|
3047
|
+
} else {
|
3048
|
+
// handle milliseconds separately because of floating point math errors (issue #1867)
|
3049
|
+
days = this._days + yearsToDays(this._months / 12);
|
3050
|
+
switch (units) {
|
3051
|
+
case 'week': return days / 7 + this._milliseconds / 6048e5;
|
3052
|
+
case 'day': return days + this._milliseconds / 864e5;
|
3053
|
+
case 'hour': return days * 24 + this._milliseconds / 36e5;
|
3054
|
+
case 'minute': return days * 24 * 60 + this._milliseconds / 6e4;
|
3055
|
+
case 'second': return days * 24 * 60 * 60 + this._milliseconds / 1000;
|
3056
|
+
// Math.floor prevents floating point math errors here
|
3057
|
+
case 'millisecond': return Math.floor(days * 24 * 60 * 60 * 1000) + this._milliseconds;
|
3058
|
+
default: throw new Error('Unknown unit ' + units);
|
3059
|
+
}
|
3060
|
+
}
|
3061
|
+
},
|
3062
|
+
|
3063
|
+
lang : moment.fn.lang,
|
3064
|
+
locale : moment.fn.locale,
|
3065
|
+
|
3066
|
+
toIsoString : deprecate(
|
3067
|
+
'toIsoString() is deprecated. Please use toISOString() instead ' +
|
3068
|
+
'(notice the capitals)',
|
3069
|
+
function () {
|
3070
|
+
return this.toISOString();
|
3071
|
+
}
|
3072
|
+
),
|
3073
|
+
|
3074
|
+
toISOString : function () {
|
3075
|
+
// inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
|
3076
|
+
var years = Math.abs(this.years()),
|
3077
|
+
months = Math.abs(this.months()),
|
3078
|
+
days = Math.abs(this.days()),
|
3079
|
+
hours = Math.abs(this.hours()),
|
3080
|
+
minutes = Math.abs(this.minutes()),
|
3081
|
+
seconds = Math.abs(this.seconds() + this.milliseconds() / 1000);
|
3082
|
+
|
3083
|
+
if (!this.asSeconds()) {
|
3084
|
+
// this is the same as C#'s (Noda) and python (isodate)...
|
3085
|
+
// but not other JS (goog.date)
|
3086
|
+
return 'P0D';
|
3087
|
+
}
|
3088
|
+
|
3089
|
+
return (this.asSeconds() < 0 ? '-' : '') +
|
3090
|
+
'P' +
|
3091
|
+
(years ? years + 'Y' : '') +
|
3092
|
+
(months ? months + 'M' : '') +
|
3093
|
+
(days ? days + 'D' : '') +
|
3094
|
+
((hours || minutes || seconds) ? 'T' : '') +
|
3095
|
+
(hours ? hours + 'H' : '') +
|
3096
|
+
(minutes ? minutes + 'M' : '') +
|
3097
|
+
(seconds ? seconds + 'S' : '');
|
3098
|
+
},
|
3099
|
+
|
3100
|
+
localeData : function () {
|
3101
|
+
return this._locale;
|
3102
|
+
}
|
3103
|
+
});
|
3104
|
+
|
3105
|
+
moment.duration.fn.toString = moment.duration.fn.toISOString;
|
3106
|
+
|
3107
|
+
function makeDurationGetter(name) {
|
3108
|
+
moment.duration.fn[name] = function () {
|
3109
|
+
return this._data[name];
|
3110
|
+
};
|
3111
|
+
}
|
3112
|
+
|
3113
|
+
for (i in unitMillisecondFactors) {
|
3114
|
+
if (hasOwnProp(unitMillisecondFactors, i)) {
|
3115
|
+
makeDurationGetter(i.toLowerCase());
|
3116
|
+
}
|
3117
|
+
}
|
3118
|
+
|
3119
|
+
moment.duration.fn.asMilliseconds = function () {
|
3120
|
+
return this.as('ms');
|
3121
|
+
};
|
3122
|
+
moment.duration.fn.asSeconds = function () {
|
3123
|
+
return this.as('s');
|
3124
|
+
};
|
3125
|
+
moment.duration.fn.asMinutes = function () {
|
3126
|
+
return this.as('m');
|
3127
|
+
};
|
3128
|
+
moment.duration.fn.asHours = function () {
|
3129
|
+
return this.as('h');
|
3130
|
+
};
|
3131
|
+
moment.duration.fn.asDays = function () {
|
3132
|
+
return this.as('d');
|
3133
|
+
};
|
3134
|
+
moment.duration.fn.asWeeks = function () {
|
3135
|
+
return this.as('weeks');
|
3136
|
+
};
|
3137
|
+
moment.duration.fn.asMonths = function () {
|
3138
|
+
return this.as('M');
|
3139
|
+
};
|
3140
|
+
moment.duration.fn.asYears = function () {
|
3141
|
+
return this.as('y');
|
3142
|
+
};
|
3143
|
+
|
3144
|
+
/************************************
|
3145
|
+
Default Locale
|
3146
|
+
************************************/
|
3147
|
+
|
3148
|
+
|
3149
|
+
// Set default locale, other locale will inherit from English.
|
3150
|
+
moment.locale('en', {
|
3151
|
+
ordinal : function (number) {
|
3152
|
+
var b = number % 10,
|
3153
|
+
output = (toInt(number % 100 / 10) === 1) ? 'th' :
|
3154
|
+
(b === 1) ? 'st' :
|
3155
|
+
(b === 2) ? 'nd' :
|
3156
|
+
(b === 3) ? 'rd' : 'th';
|
3157
|
+
return number + output;
|
3158
|
+
}
|
3159
|
+
});
|
3160
|
+
|
3161
|
+
return moment;
|
3162
|
+
|
3163
|
+
}).call(this);
|
323
3164
|
|
324
|
-
|
325
|
-
0)+36E5*(a.hour||0);this._days=+f+7*d;this._months=+c+12*b;this._data={};this._bubble()}function v(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);b.hasOwnProperty("toString")&&(a.toString=b.toString);b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf);return a}function w(a){return 0>a?Math.ceil(a):Math.floor(a)}function l(a,b,c){for(var d=""+Math.abs(a);d.length<b;)d="0"+d;return(0<=a?c?"+":"":"-")+d}function J(a,b,c,d){var f=b._milliseconds,g=b._days;b=b._months;var m,h;f&&a._d.setTime(+a._d+
|
326
|
-
f*c);if(g||b)m=a.minute(),h=a.hour();g&&a.date(a.date()+g*c);b&&a.month(a.month()+b*c);f&&!d&&e.updateOffset(a,g||b);if(g||b)a.minute(m),a.hour(h)}function K(a){return"[object Array]"===Object.prototype.toString.call(a)}function ca(a,b,c){var d=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0,e;for(e=0;e<d;e++)(c&&a[e]!==b[e]||!c&&h(a[e])!==h(b[e]))&&g++;return g+f}function n(a){if(a){var b=a.toLowerCase().replace(/(.)s$/,"$1");a=ua[a]||va[b]||b}return a}function ba(a){var b={},c,d;for(d in a)a.hasOwnProperty(d)&&
|
327
|
-
(c=n(d))&&(b[c]=a[d]);return b}function wa(a){var b,c;if(0===a.indexOf("week"))b=7,c="day";else if(0===a.indexOf("month"))b=12,c="month";else return;e[a]=function(d,f){var g,m,h=e.fn._lang[a],k=[];"number"===typeof d&&(f=d,d=B);m=function(a){a=e().utc().set(c,a);return h.call(e.fn._lang,a,d||"")};if(null!=f)return m(f);for(g=0;g<b;g++)k.push(m(g));return k}}function h(a){a=+a;var b=0;0!==a&&isFinite(a)&&(b=0<=a?Math.floor(a):Math.ceil(a));return b}function L(a,b){return(new Date(Date.UTC(a,b+1,0))).getUTCDate()}
|
328
|
-
function da(a,b,c){return C(e([a,11,31+b-c]),b,c).week}function M(a){return 0===a%4&&0!==a%100||0===a%400}function aa(a){var b;a._a&&-2===a._pf.overflow&&(b=0>a._a[x]||11<a._a[x]?x:1>a._a[q]||a._a[q]>L(a._a[r],a._a[x])?q:0>a._a[p]||23<a._a[p]?p:0>a._a[y]||59<a._a[y]?y:0>a._a[D]||59<a._a[D]?D:0>a._a[E]||999<a._a[E]?E:-1,a._pf._overflowDayOfYear&&(b<r||b>q)&&(b=q),a._pf.overflow=b)}function ea(a){null==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&0>a._pf.overflow&&!a._pf.empty&&!a._pf.invalidMonth&&
|
329
|
-
!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length));return a._isValid}function N(a){return a?a.toLowerCase().replace("_","-"):a}function O(a,b){return b._isUTC?e(a).zone(b._offset||0):e(a).local()}function s(a){var b=0,c,d,f,g,m=function(a){if(!z[a]&&xa)try{require("./lang/"+a)}catch(b){}return z[a]};if(!a)return e.fn._lang;if(!K(a)){if(d=m(a))return d;a=[a]}for(;b<a.length;){g=N(a[b]).split("-");
|
330
|
-
c=g.length;for(f=(f=N(a[b+1]))?f.split("-"):null;0<c;){if(d=m(g.slice(0,c).join("-")))return d;if(f&&f.length>=c&&ca(g,f,!0)>=c-1)break;c--}b++}return e.fn._lang}function ya(a){return a.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}function za(a){var b=a.match(fa),c,d;c=0;for(d=b.length;c<d;c++)b[c]=u[b[c]]?u[b[c]]:ya(b[c]);return function(f){var g="";for(c=0;c<d;c++)g+=b[c]instanceof Function?b[c].call(f,a):b[c];return g}}function P(a,b){if(!a.isValid())return a.lang().invalidDate();
|
331
|
-
b=ga(b,a.lang());Q[b]||(Q[b]=za(b));return Q[b](a)}function ga(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(F.lastIndex=0;0<=d&&F.test(a);)a=a.replace(F,c),F.lastIndex=0,d-=1;return a}function Aa(a,b){var c=b._strict;switch(a){case "DDDD":return ha;case "YYYY":case "GGGG":case "gggg":return c?Ba:Ca;case "Y":case "G":case "g":return Da;case "YYYYYY":case "YYYYY":case "GGGGG":case "ggggg":return c?Ea:Fa;case "S":if(c)return Ga;case "SS":if(c)return ia;case "SSS":if(c)return ha;case "DDD":return Ha;
|
332
|
-
case "MMM":case "MMMM":case "dd":case "ddd":case "dddd":return Ia;case "a":case "A":return s(b._l)._meridiemParse;case "X":return Ja;case "Z":case "ZZ":return R;case "T":return Ka;case "SSSS":return La;case "MM":case "DD":case "YY":case "GG":case "gg":case "HH":case "hh":case "mm":case "ss":case "ww":case "WW":return c?ia:ja;case "M":case "D":case "d":case "H":case "h":case "m":case "s":case "w":case "W":case "e":case "E":return ja;case "Do":return Ma;default:var c=RegExp,d;d=Na(a.replace("\\","")).replace(/[-\/\\^$*+?.()|[\]{}]/g,
|
333
|
-
"\\$&");return new c(d)}}function ka(a){a=(a||"").match(R)||[];a=((a[a.length-1]||[])+"").match(Oa)||["-",0,0];var b=+(60*a[1])+h(a[2]);return"+"===a[0]?-b:b}function S(a){var b,c=[],d,f,g,m,k;if(!a._d){d=Pa(a);a._w&&null==a._a[q]&&null==a._a[x]&&(b=function(b){var c=parseInt(b,10);return b?3>b.length?68<c?1900+c:2E3+c:c:null==a._a[r]?e().weekYear():a._a[r]},f=a._w,null!=f.GG||null!=f.W||null!=f.E?b=la(b(f.GG),f.W||1,f.E,4,1):(g=s(a._l),m=null!=f.d?ma(f.d,g):null!=f.e?parseInt(f.e,10)+g._week.dow:
|
334
|
-
0,k=parseInt(f.w,10)||1,null!=f.d&&m<g._week.dow&&k++,b=la(b(f.gg),k,m,g._week.doy,g._week.dow)),a._a[r]=b.year,a._dayOfYear=b.dayOfYear);a._dayOfYear&&(b=null==a._a[r]?d[r]:a._a[r],a._dayOfYear>(M(b)?366:365)&&(a._pf._overflowDayOfYear=!0),b=T(b,0,a._dayOfYear),a._a[x]=b.getUTCMonth(),a._a[q]=b.getUTCDate());for(b=0;3>b&&null==a._a[b];++b)a._a[b]=c[b]=d[b];for(;7>b;b++)a._a[b]=c[b]=null==a._a[b]?2===b?1:0:a._a[b];c[p]+=h((a._tzm||0)/60);c[y]+=h((a._tzm||0)%60);a._d=(a._useUTC?T:Qa).apply(null,c)}}
|
335
|
-
function Pa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function U(a){a._a=[];a._pf.empty=!0;var b=s(a._l),c=""+a._i,d,f,g,e,k=c.length,l=0;f=ga(a._f,b).match(fa)||[];for(b=0;b<f.length;b++){g=f[b];if(d=(c.match(Aa(g,a))||[])[0])e=c.substr(0,c.indexOf(d)),0<e.length&&a._pf.unusedInput.push(e),c=c.slice(c.indexOf(d)+d.length),l+=d.length;if(u[g]){d?a._pf.empty=!1:a._pf.unusedTokens.push(g);e=a;var n=void 0,t=e._a;
|
336
|
-
switch(g){case "M":case "MM":null!=d&&(t[x]=h(d)-1);break;case "MMM":case "MMMM":n=s(e._l).monthsParse(d);null!=n?t[x]=n:e._pf.invalidMonth=d;break;case "D":case "DD":null!=d&&(t[q]=h(d));break;case "Do":null!=d&&(t[q]=h(parseInt(d,10)));break;case "DDD":case "DDDD":null!=d&&(e._dayOfYear=h(d));break;case "YY":t[r]=h(d)+(68<h(d)?1900:2E3);break;case "YYYY":case "YYYYY":case "YYYYYY":t[r]=h(d);break;case "a":case "A":e._isPm=s(e._l).isPM(d);break;case "H":case "HH":case "h":case "hh":t[p]=h(d);break;
|
337
|
-
case "m":case "mm":t[y]=h(d);break;case "s":case "ss":t[D]=h(d);break;case "S":case "SS":case "SSS":case "SSSS":t[E]=h(1E3*("0."+d));break;case "X":e._d=new Date(1E3*parseFloat(d));break;case "Z":case "ZZ":e._useUTC=!0;e._tzm=ka(d);break;case "w":case "ww":case "W":case "WW":case "d":case "dd":case "ddd":case "dddd":case "e":case "E":g=g.substr(0,1);case "gg":case "gggg":case "GG":case "GGGG":case "GGGGG":g=g.substr(0,2),d&&(e._w=e._w||{},e._w[g]=d)}}else a._strict&&!d&&a._pf.unusedTokens.push(g)}a._pf.charsLeftOver=
|
338
|
-
k-l;0<c.length&&a._pf.unusedInput.push(c);a._isPm&&12>a._a[p]&&(a._a[p]+=12);!1===a._isPm&&12===a._a[p]&&(a._a[p]=0);S(a);aa(a)}function Na(a){return a.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,c,d,f,e){return c||d||f||e})}function Qa(a,b,c,d,f,e,h){b=new Date(a,b,c,d,f,e,h);1970>a&&b.setFullYear(a);return b}function T(a){var b=new Date(Date.UTC.apply(null,arguments));1970>a&&b.setUTCFullYear(a);return b}function ma(a,b){if("string"===typeof a)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!==
|
339
|
-
typeof a)return null}else a=parseInt(a,10);return a}function Ra(a,b,c,d,f){return f.relativeTime(b||1,!!c,a,d)}function C(a,b,c){b=c-b;c-=a.day();c>b&&(c-=7);c<b-7&&(c+=7);a=e(a).add("d",c);return{week:Math.ceil(a.dayOfYear()/7),year:a.year()}}function la(a,b,c,d,f){var e=T(a,0,1).getUTCDay();b=7*(b-1)+((null!=c?c:f)-f)+(f-e+(e>d?7:0)-(e<f?7:0))+1;return{year:0<b?a:a-1,dayOfYear:0<b?b:(M(a-1)?366:365)+b}}function na(a){var b=a._i,c=a._f;if(null===b)return e.invalid({nullInput:!0});"string"===typeof b&&
|
340
|
-
(a._i=b=s().preparse(b));if(e.isMoment(b)){a=b;var d={},f;for(f in a)a.hasOwnProperty(f)&&Sa.hasOwnProperty(f)&&(d[f]=a[f]);a=d;a._d=new Date(+b._d)}else if(c)if(K(c)){var b=a,g,h;if(0===b._f.length)b._pf.invalidFormat=!0,b._d=new Date(NaN);else{for(f=0;f<b._f.length;f++)if(c=0,d=v({},b),d._pf=G(),d._f=b._f[f],U(d),ea(d)&&(c+=d._pf.charsLeftOver,c+=10*d._pf.unusedTokens.length,d._pf.score=c,null==h||c<h))h=c,g=d;v(b,g||d)}}else U(a);else if(d=a,g=d._i,h=Ta.exec(g),g===B)d._d=new Date;else if(h)d._d=
|
341
|
-
new Date(+h[1]);else if("string"===typeof g)if(b=d._i,f=Ua.exec(b)){d._pf.iso=!0;g=0;for(h=V.length;g<h;g++)if(V[g][1].exec(b)){d._f=V[g][0]+(f[6]||" ");break}g=0;for(h=W.length;g<h;g++)if(W[g][1].exec(b)){d._f+=W[g][0];break}b.match(R)&&(d._f+="Z");U(d)}else d._d=new Date(b);else K(g)?(d._a=g.slice(0),S(d)):"[object Date]"===Object.prototype.toString.call(g)||g instanceof Date?d._d=new Date(+g):"object"===typeof g?d._d||(g=ba(d._i),d._a=[g.year,g.month,g.day,g.hour,g.minute,g.second,g.millisecond],
|
342
|
-
S(d)):d._d=new Date(g);return new H(a)}function oa(a,b){var c="date"===b||"month"===b||"year"===b;e.fn[a]=e.fn[a+"s"]=function(a,f){var g=this._isUTC?"UTC":"";null==f&&(f=c);return null!=a?(this._d["set"+g+b](a),e.updateOffset(this,f),this):this._d["get"+g+b]()}}function Va(a){e.duration.fn[a]=function(){return this._data[a]}}function pa(a,b){e.duration.fn["as"+a]=function(){return+this/b}}for(var e,A=Math.round,k,r=0,x=1,q=2,p=3,y=4,D=5,E=6,z={},Sa={_isAMomentObject:null,_i:null,_f:null,_l:null,
|
343
|
-
_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},xa="undefined"!==typeof module&&module.exports&&"undefined"!==typeof require,Ta=/^\/?Date\((\-?\d+)/i,Wa=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,Xa=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,fa=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
|
344
|
-
F=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,ja=/\d\d?/,Ha=/\d{1,3}/,Ca=/\d{1,4}/,Fa=/[+\-]?\d{1,6}/,La=/\d+/,Ia=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,R=/Z|[\+\-]\d\d:?\d\d/gi,Ka=/T/i,Ja=/[\+\-]?\d+(\.\d{1,3})?/,Ma=/\d{1,2}/,Ga=/\d/,ia=/\d\d/,ha=/\d{3}/,Ba=/\d{4}/,Ea=/[+-]?\d{6}/,Da=/[+-]?\d+/,Ua=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
|
345
|
-
V=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],W=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Oa=/([\+\-]|\d\d)/gi,X=["Date","Hours","Minutes","Seconds","Milliseconds"],Y={Milliseconds:1,Seconds:1E3,Minutes:6E4,Hours:36E5,Days:864E5,Months:2592E6,Years:31536E6},ua={ms:"millisecond",s:"second",
|
346
|
-
m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},va={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Q={},qa="DDD w W M D d".split(" "),ra="MDHhmswW".split(""),u={M:function(){return this.month()+1},MMM:function(a){return this.lang().monthsShort(this,a)},MMMM:function(a){return this.lang().months(this,a)},D:function(){return this.date()},
|
347
|
-
DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(a){return this.lang().weekdaysMin(this,a)},ddd:function(a){return this.lang().weekdaysShort(this,a)},dddd:function(a){return this.lang().weekdays(this,a)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return l(this.year()%100,2)},YYYY:function(){return l(this.year(),4)},YYYYY:function(){return l(this.year(),5)},YYYYYY:function(){var a=this.year();return(0<=a?"+":"-")+l(Math.abs(a),
|
348
|
-
6)},gg:function(){return l(this.weekYear()%100,2)},gggg:function(){return l(this.weekYear(),4)},ggggg:function(){return l(this.weekYear(),5)},GG:function(){return l(this.isoWeekYear()%100,2)},GGGG:function(){return l(this.isoWeekYear(),4)},GGGGG:function(){return l(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),
|
349
|
-
!1)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return h(this.milliseconds()/100)},SS:function(){return l(h(this.milliseconds()/10),2)},SSS:function(){return l(this.milliseconds(),3)},SSSS:function(){return l(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");return b+l(h(a/60),2)+":"+l(h(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";0>a&&(a=-a,b="-");
|
350
|
-
return b+l(h(a/60),2)+l(h(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},sa=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];qa.length;)k=qa.pop(),u[k+"o"]=ta(u[k],k);for(;ra.length;)k=ra.pop(),u[k+k]=Z(u[k],2);u.DDDD=Z(u.DDD,3);v($.prototype,{set:function(a){var b,c;for(c in a)b=a[c],"function"===typeof b?this[c]=b:this["_"+c]=b},_months:"January February March April May June July August September October November December".split(" "),
|
351
|
-
months:function(a){return this._months[a.month()]},_monthsShort:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),monthsShort:function(a){return this._monthsShort[a.month()]},monthsParse:function(a){var b,c;this._monthsParse||(this._monthsParse=[]);for(b=0;12>b;b++)if(this._monthsParse[b]||(c=e.utc([2E3,b]),c="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=RegExp(c.replace(".",""),"i")),this._monthsParse[b].test(a))return b},_weekdays:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),
|
352
|
-
weekdays:function(a){return this._weekdays[a.day()]},_weekdaysShort:"Sun Mon Tue Wed Thu Fri Sat".split(" "),weekdaysShort:function(a){return this._weekdaysShort[a.day()]},_weekdaysMin:"Su Mo Tu We Th Fr Sa".split(" "),weekdaysMin:function(a){return this._weekdaysMin[a.day()]},weekdaysParse:function(a){var b,c;this._weekdaysParse||(this._weekdaysParse=[]);for(b=0;7>b;b++)if(this._weekdaysParse[b]||(c=e([2E3,1]).day(b),c="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,
|
353
|
-
""),this._weekdaysParse[b]=RegExp(c.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){var b=this._longDateFormat[a];!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b);return b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},
|
354
|
-
_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){return 11<a?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){var c=this._calendar[a];return"function"===typeof c?c.apply(b):c},_relativeTime:{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",
|
355
|
-
y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){var f=this._relativeTime[c];return"function"===typeof f?f(a,b,c,d):f.replace(/%d/i,a)},pastFuture:function(a,b){var c=this._relativeTime[0<a?"future":"past"];return"function"===typeof c?c(b):c.replace(/%s/i,b)},ordinal:function(a){return this._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){return a},postformat:function(a){return a},week:function(a){return C(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",
|
356
|
-
invalidDate:function(){return this._invalidDate}});e=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0};f._i=a;f._f=b;f._l=c;f._strict=d;f._isUTC=!1;f._pf=G();return na(f)};e.utc=function(a,b,c,d){var f;"boolean"===typeof c&&(d=c,c=B);f={_isAMomentObject:!0,_useUTC:!0,_isUTC:!0};f._l=c;f._i=a;f._f=b;f._strict=d;f._pf=G();return na(f).utc()};e.unix=function(a){return e(1E3*a)};e.duration=function(a,b){var c=a,d=null,f;if(e.isDuration(a))c={ms:a._milliseconds,d:a._days,
|
357
|
-
M:a._months};else if("number"===typeof a)c={},b?c[b]=a:c.milliseconds=a;else if(d=Wa.exec(a))f="-"===d[1]?-1:1,c={y:0,d:h(d[q])*f,h:h(d[p])*f,m:h(d[y])*f,s:h(d[D])*f,ms:h(d[E])*f};else if(d=Xa.exec(a))f="-"===d[1]?-1:1,c=function(a){a=a&&parseFloat(a.replace(",","."));return(isNaN(a)?0:a)*f},c={y:c(d[2]),M:c(d[3]),d:c(d[4]),h:c(d[5]),m:c(d[6]),s:c(d[7]),w:c(d[8])};d=new I(c);e.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang);return d};e.version="2.5.1";e.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";
|
358
|
-
e.updateOffset=function(){};e.lang=function(a,b){if(!a)return e.fn._lang._abbr;if(b){var c=N(a);b.abbr=c;z[c]||(z[c]=new $);z[c].set(b)}else null===b?(delete z[a],a="en"):z[a]||s(a);return(e.duration.fn._lang=e.fn._lang=s(a))._abbr};e.langData=function(a){a&&a._lang&&a._lang._abbr&&(a=a._lang._abbr);return s(a)};e.isMoment=function(a){return a instanceof H||null!=a&&a.hasOwnProperty("_isAMomentObject")};e.isDuration=function(a){return a instanceof I};for(k=sa.length-1;0<=k;--k)wa(sa[k]);e.normalizeUnits=
|
359
|
-
function(a){return n(a)};e.invalid=function(a){var b=e.utc(NaN);null!=a?v(b._pf,a):b._pf.userInvalidated=!0;return b};e.parseZone=function(){return e.apply(null,arguments).parseZone()};v(e.fn=H.prototype,{clone:function(){return e(this)},valueOf:function(){return+this._d+6E4*(this._offset||0)},unix:function(){return Math.floor(+this/1E3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=
|
360
|
-
e(this).utc();return 0<a.year()&&9999>=a.year()?P(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):P(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){return[this.year(),this.month(),this.date(),this.hours(),this.minutes(),this.seconds(),this.milliseconds()]},isValid:function(){return ea(this)},isDSTShifted:function(){return this._a?this.isValid()&&0<ca(this._a,(this._isUTC?e.utc(this._a):e(this._a)).toArray()):!1},parsingFlags:function(){return v({},this._pf)},invalidAt:function(){return this._pf.overflow},
|
361
|
-
utc:function(){return this.zone(0)},local:function(){this.zone(0);this._isUTC=!1;return this},format:function(a){a=P(this,a||e.defaultFormat);return this.lang().postformat(a)},add:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,1);return this},subtract:function(a,b){var c;c="string"===typeof a?e.duration(+b,a):e.duration(a,b);J(this,c,-1);return this},diff:function(a,b,c){a=O(a,this);var d=6E4*(this.zone()-a.zone()),f;b=n(b);"year"===b||"month"===b?(f=432E5*(this.daysInMonth()+
|
362
|
-
a.daysInMonth()),d=12*(this.year()-a.year())+(this.month()-a.month()),d+=(this-e(this).startOf("month")-(a-e(a).startOf("month")))/f,d-=6E4*(this.zone()-e(this).startOf("month").zone()-(a.zone()-e(a).startOf("month").zone()))/f,"year"===b&&(d/=12)):(f=this-a,d="second"===b?f/1E3:"minute"===b?f/6E4:"hour"===b?f/36E5:"day"===b?(f-d)/864E5:"week"===b?(f-d)/6048E5:f);return c?d:w(d)},from:function(a,b){return e.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){return this.from(e(),
|
363
|
-
a)},calendar:function(){var a=O(e(),this).startOf("day"),a=this.diff(a,"days",!0),a=-6>a?"sameElse":-1>a?"lastWeek":0>a?"lastDay":1>a?"sameDay":2>a?"nextDay":7>a?"nextWeek":"sameElse";return this.format(this.lang().calendar(a,this))},isLeapYear:function(){return M(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=ma(a,this.lang()),this.add({d:a-
|
364
|
-
b})):b},month:function(a){var b=this._isUTC?"UTC":"",c;if(null!=a){if("string"===typeof a&&(a=this.lang().monthsParse(a),"number"!==typeof a))return this;c=Math.min(this.date(),L(this.year(),a));this._d["set"+b+"Month"](a,c);e.updateOffset(this,!0);return this}return this._d["get"+b+"Month"]()},startOf:function(a){a=n(a);switch(a){case "year":this.month(0);case "month":this.date(1);case "week":case "isoWeek":case "day":this.hours(0);case "hour":this.minutes(0);case "minute":this.seconds(0);case "second":this.milliseconds(0)}"week"===
|
365
|
-
a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1);return this},endOf:function(a){a=n(a);return this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)>+e(a).startOf(b)},isBefore:function(a,b){b="undefined"!==typeof b?b:"millisecond";return+this.clone().startOf(b)<+e(a).startOf(b)},isSame:function(a,b){b=b||"ms";return+this.clone().startOf(b)===+O(a,this).startOf(b)},min:function(a){a=e.apply(null,
|
366
|
-
arguments);return a<this?this:a},max:function(a){a=e.apply(null,arguments);return a>this?this:a},zone:function(a,b){b=null==b?!0:!1;var c=this._offset||0;if(null!=a)"string"===typeof a&&(a=ka(a)),16>Math.abs(a)&&(a*=60),this._offset=a,this._isUTC=!0,c!==a&&b&&J(this,e.duration(c-a,"m"),1,!0);else return this._isUTC?c:this._d.getTimezoneOffset();return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){this._tzm?
|
367
|
-
this.zone(this._tzm):"string"===typeof this._i&&this.zone(this._i);return this},hasAlignedHourOffset:function(a){a=a?e(a).zone():0;return 0===(this.zone()-a)%60},daysInMonth:function(){return L(this.year(),this.month())},dayOfYear:function(a){var b=A((e(this).startOf("day")-e(this).startOf("year"))/864E5)+1;return null==a?b:this.add("d",a-b)},quarter:function(){return Math.ceil((this.month()+1)/3)},weekYear:function(a){var b=C(this,this.lang()._week.dow,this.lang()._week.doy).year;return null==a?
|
368
|
-
b:this.add("y",a-b)},isoWeekYear:function(a){var b=C(this,1,4).year;return null==a?b:this.add("y",a-b)},week:function(a){var b=this.lang().week(this);return null==a?b:this.add("d",7*(a-b))},isoWeek:function(a){var b=C(this,1,4).week;return null==a?b:this.add("d",7*(a-b))},weekday:function(a){var b=(this.day()+7-this.lang()._week.dow)%7;return null==a?b:this.add("d",a-b)},isoWeekday:function(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)},isoWeeksInYear:function(){return da(this.year(),
|
369
|
-
1,4)},weeksInYear:function(){var a=this._lang._week;return da(this.year(),a.dow,a.doy)},get:function(a){a=n(a);return this[a]()},set:function(a,b){a=n(a);if("function"===typeof this[a])this[a](b);return this},lang:function(a){if(a===B)return this._lang;this._lang=s(a);return this}});for(k=0;k<X.length;k++)oa(X[k].toLowerCase().replace(/s$/,""),X[k]);oa("year","FullYear");e.fn.days=e.fn.day;e.fn.months=e.fn.month;e.fn.weeks=e.fn.week;e.fn.isoWeeks=e.fn.isoWeek;e.fn.toJSON=e.fn.toISOString;v(e.duration.fn=
|
370
|
-
I.prototype,{_bubble:function(){var a=this._milliseconds,b=this._days,c=this._months,d=this._data;d.milliseconds=a%1E3;a=w(a/1E3);d.seconds=a%60;a=w(a/60);d.minutes=a%60;a=w(a/60);d.hours=a%24;b+=w(a/24);d.days=b%30;c+=w(b/30);d.months=c%12;b=w(c/12);d.years=b},weeks:function(){return w(this.days()/7)},valueOf:function(){return this._milliseconds+864E5*this._days+this._months%12*2592E6+31536E6*h(this._months/12)},humanize:function(a){var b=+this,c;c=!a;var d=this.lang(),f=A(Math.abs(b)/1E3),e=A(f/
|
371
|
-
60),h=A(e/60),k=A(h/24),l=A(k/365),f=45>f&&["s",f]||1===e&&["m"]||45>e&&["mm",e]||1===h&&["h"]||22>h&&["hh",h]||1===k&&["d"]||25>=k&&["dd",k]||45>=k&&["M"]||345>k&&["MM",A(k/30)]||1===l&&["y"]||["yy",l];f[2]=c;f[3]=0<b;f[4]=d;c=Ra.apply({},f);a&&(c=this.lang().pastFuture(b,c));return this.lang().postformat(c)},add:function(a,b){var c=e.duration(a,b);this._milliseconds+=c._milliseconds;this._days+=c._days;this._months+=c._months;this._bubble();return this},subtract:function(a,b){var c=e.duration(a,
|
372
|
-
b);this._milliseconds-=c._milliseconds;this._days-=c._days;this._months-=c._months;this._bubble();return this},get:function(a){a=n(a);return this[a.toLowerCase()+"s"]()},as:function(a){a=n(a);return this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:e.fn.lang,toIsoString:function(){var a=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),g=Math.abs(this.seconds()+this.milliseconds()/1E3);return this.asSeconds()?(0>
|
373
|
-
this.asSeconds()?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||g?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(g?g+"S":""):"P0D"}});for(k in Y)Y.hasOwnProperty(k)&&(pa(k,Y[k]),Va(k.toLowerCase()));pa("Weeks",6048E5);e.duration.fn.asMonths=function(){return(+this-31536E6*this.years())/2592E6+12*this.years()};e.lang("en",{ordinal:function(a){var b=a%10,b=1===h(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+b}});return e}).call(this);
|
374
|
-
|
375
|
-
UI.datepicker.moment = moment;
|
3165
|
+
UI.Utils.moment = moment;
|
376
3166
|
|
377
3167
|
return UI.datepicker;
|
378
|
-
});
|
3168
|
+
});
|