@angular/material-moment-adapter 13.0.0-next.7 → 13.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/adapter/index.d.ts +7 -7
- package/adapter/moment-date-adapter.d.ts +3 -0
- package/esm2020/adapter/index.mjs +50 -0
- package/esm2020/adapter/moment-date-adapter.mjs +200 -0
- package/{esm2015/adapter/moment-date-formats.js → esm2020/adapter/moment-date-formats.mjs} +1 -1
- package/esm2020/index.mjs +9 -0
- package/esm2020/material-moment-adapter_public_index.mjs +5 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/material-moment-adapter.mjs +281 -0
- package/fesm2015/material-moment-adapter.mjs.map +1 -0
- package/{fesm2015/material-moment-adapter.js → fesm2020/material-moment-adapter.mjs} +61 -33
- package/fesm2020/material-moment-adapter.mjs.map +1 -0
- package/index.d.ts +5 -1
- package/material-moment-adapter_public_index.d.ts +4 -0
- package/package.json +23 -9
- package/bundles/material-moment-adapter.umd.js +0 -608
- package/bundles/material-moment-adapter.umd.js.map +0 -1
- package/esm2015/adapter/index.js +0 -37
- package/esm2015/adapter/moment-date-adapter.js +0 -193
- package/esm2015/index.js +0 -5
- package/esm2015/material-moment-adapter.externs.js +0 -6
- package/fesm2015/material-moment-adapter.js.map +0 -1
- package/index.metadata.json +0 -1
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/core'), require('moment')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@angular/material-moment-adapter', ['exports', '@angular/core', '@angular/material/core', 'moment'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ng = global.ng || {}, global.ng.materialMomentAdapter = {}), global.ng.core, global.ng.material.core, global.moment));
|
|
5
|
-
}(this, (function (exports, core, core$1, _rollupMoment) { 'use strict';
|
|
6
|
-
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
-
|
|
9
|
-
function _interopNamespace(e) {
|
|
10
|
-
if (e && e.__esModule) return e;
|
|
11
|
-
var n = Object.create(null);
|
|
12
|
-
if (e) {
|
|
13
|
-
Object.keys(e).forEach(function (k) {
|
|
14
|
-
if (k !== 'default') {
|
|
15
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () {
|
|
19
|
-
return e[k];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
n['default'] = e;
|
|
26
|
-
return Object.freeze(n);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var _rollupMoment__default = /*#__PURE__*/_interopDefaultLegacy(_rollupMoment);
|
|
30
|
-
var _rollupMoment__namespace = /*#__PURE__*/_interopNamespace(_rollupMoment);
|
|
31
|
-
|
|
32
|
-
/*! *****************************************************************************
|
|
33
|
-
Copyright (c) Microsoft Corporation.
|
|
34
|
-
|
|
35
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
36
|
-
purpose with or without fee is hereby granted.
|
|
37
|
-
|
|
38
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
39
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
40
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
41
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
42
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
43
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
44
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
45
|
-
***************************************************************************** */
|
|
46
|
-
/* global Reflect, Promise */
|
|
47
|
-
var extendStatics = function (d, b) {
|
|
48
|
-
extendStatics = Object.setPrototypeOf ||
|
|
49
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
50
|
-
function (d, b) { for (var p in b)
|
|
51
|
-
if (Object.prototype.hasOwnProperty.call(b, p))
|
|
52
|
-
d[p] = b[p]; };
|
|
53
|
-
return extendStatics(d, b);
|
|
54
|
-
};
|
|
55
|
-
function __extends(d, b) {
|
|
56
|
-
if (typeof b !== "function" && b !== null)
|
|
57
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
58
|
-
extendStatics(d, b);
|
|
59
|
-
function __() { this.constructor = d; }
|
|
60
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
61
|
-
}
|
|
62
|
-
var __assign = function () {
|
|
63
|
-
__assign = Object.assign || function __assign(t) {
|
|
64
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
65
|
-
s = arguments[i];
|
|
66
|
-
for (var p in s)
|
|
67
|
-
if (Object.prototype.hasOwnProperty.call(s, p))
|
|
68
|
-
t[p] = s[p];
|
|
69
|
-
}
|
|
70
|
-
return t;
|
|
71
|
-
};
|
|
72
|
-
return __assign.apply(this, arguments);
|
|
73
|
-
};
|
|
74
|
-
function __rest(s, e) {
|
|
75
|
-
var t = {};
|
|
76
|
-
for (var p in s)
|
|
77
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
78
|
-
t[p] = s[p];
|
|
79
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
80
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
81
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
82
|
-
t[p[i]] = s[p[i]];
|
|
83
|
-
}
|
|
84
|
-
return t;
|
|
85
|
-
}
|
|
86
|
-
function __decorate(decorators, target, key, desc) {
|
|
87
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
88
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
89
|
-
r = Reflect.decorate(decorators, target, key, desc);
|
|
90
|
-
else
|
|
91
|
-
for (var i = decorators.length - 1; i >= 0; i--)
|
|
92
|
-
if (d = decorators[i])
|
|
93
|
-
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
94
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
95
|
-
}
|
|
96
|
-
function __param(paramIndex, decorator) {
|
|
97
|
-
return function (target, key) { decorator(target, key, paramIndex); };
|
|
98
|
-
}
|
|
99
|
-
function __metadata(metadataKey, metadataValue) {
|
|
100
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
101
|
-
return Reflect.metadata(metadataKey, metadataValue);
|
|
102
|
-
}
|
|
103
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
104
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
105
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
106
|
-
function fulfilled(value) { try {
|
|
107
|
-
step(generator.next(value));
|
|
108
|
-
}
|
|
109
|
-
catch (e) {
|
|
110
|
-
reject(e);
|
|
111
|
-
} }
|
|
112
|
-
function rejected(value) { try {
|
|
113
|
-
step(generator["throw"](value));
|
|
114
|
-
}
|
|
115
|
-
catch (e) {
|
|
116
|
-
reject(e);
|
|
117
|
-
} }
|
|
118
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
119
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
function __generator(thisArg, body) {
|
|
123
|
-
var _ = { label: 0, sent: function () { if (t[0] & 1)
|
|
124
|
-
throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
125
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
|
|
126
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
127
|
-
function step(op) {
|
|
128
|
-
if (f)
|
|
129
|
-
throw new TypeError("Generator is already executing.");
|
|
130
|
-
while (_)
|
|
131
|
-
try {
|
|
132
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
|
|
133
|
-
return t;
|
|
134
|
-
if (y = 0, t)
|
|
135
|
-
op = [op[0] & 2, t.value];
|
|
136
|
-
switch (op[0]) {
|
|
137
|
-
case 0:
|
|
138
|
-
case 1:
|
|
139
|
-
t = op;
|
|
140
|
-
break;
|
|
141
|
-
case 4:
|
|
142
|
-
_.label++;
|
|
143
|
-
return { value: op[1], done: false };
|
|
144
|
-
case 5:
|
|
145
|
-
_.label++;
|
|
146
|
-
y = op[1];
|
|
147
|
-
op = [0];
|
|
148
|
-
continue;
|
|
149
|
-
case 7:
|
|
150
|
-
op = _.ops.pop();
|
|
151
|
-
_.trys.pop();
|
|
152
|
-
continue;
|
|
153
|
-
default:
|
|
154
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
155
|
-
_ = 0;
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
159
|
-
_.label = op[1];
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
163
|
-
_.label = t[1];
|
|
164
|
-
t = op;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
if (t && _.label < t[2]) {
|
|
168
|
-
_.label = t[2];
|
|
169
|
-
_.ops.push(op);
|
|
170
|
-
break;
|
|
171
|
-
}
|
|
172
|
-
if (t[2])
|
|
173
|
-
_.ops.pop();
|
|
174
|
-
_.trys.pop();
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
op = body.call(thisArg, _);
|
|
178
|
-
}
|
|
179
|
-
catch (e) {
|
|
180
|
-
op = [6, e];
|
|
181
|
-
y = 0;
|
|
182
|
-
}
|
|
183
|
-
finally {
|
|
184
|
-
f = t = 0;
|
|
185
|
-
}
|
|
186
|
-
if (op[0] & 5)
|
|
187
|
-
throw op[1];
|
|
188
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
var __createBinding = Object.create ? (function (o, m, k, k2) {
|
|
192
|
-
if (k2 === undefined)
|
|
193
|
-
k2 = k;
|
|
194
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
|
|
195
|
-
}) : (function (o, m, k, k2) {
|
|
196
|
-
if (k2 === undefined)
|
|
197
|
-
k2 = k;
|
|
198
|
-
o[k2] = m[k];
|
|
199
|
-
});
|
|
200
|
-
function __exportStar(m, o) {
|
|
201
|
-
for (var p in m)
|
|
202
|
-
if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
|
|
203
|
-
__createBinding(o, m, p);
|
|
204
|
-
}
|
|
205
|
-
function __values(o) {
|
|
206
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
207
|
-
if (m)
|
|
208
|
-
return m.call(o);
|
|
209
|
-
if (o && typeof o.length === "number")
|
|
210
|
-
return {
|
|
211
|
-
next: function () {
|
|
212
|
-
if (o && i >= o.length)
|
|
213
|
-
o = void 0;
|
|
214
|
-
return { value: o && o[i++], done: !o };
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
218
|
-
}
|
|
219
|
-
function __read(o, n) {
|
|
220
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
221
|
-
if (!m)
|
|
222
|
-
return o;
|
|
223
|
-
var i = m.call(o), r, ar = [], e;
|
|
224
|
-
try {
|
|
225
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
|
|
226
|
-
ar.push(r.value);
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
e = { error: error };
|
|
230
|
-
}
|
|
231
|
-
finally {
|
|
232
|
-
try {
|
|
233
|
-
if (r && !r.done && (m = i["return"]))
|
|
234
|
-
m.call(i);
|
|
235
|
-
}
|
|
236
|
-
finally {
|
|
237
|
-
if (e)
|
|
238
|
-
throw e.error;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
return ar;
|
|
242
|
-
}
|
|
243
|
-
/** @deprecated */
|
|
244
|
-
function __spread() {
|
|
245
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
246
|
-
ar = ar.concat(__read(arguments[i]));
|
|
247
|
-
return ar;
|
|
248
|
-
}
|
|
249
|
-
/** @deprecated */
|
|
250
|
-
function __spreadArrays() {
|
|
251
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++)
|
|
252
|
-
s += arguments[i].length;
|
|
253
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
254
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
255
|
-
r[k] = a[j];
|
|
256
|
-
return r;
|
|
257
|
-
}
|
|
258
|
-
function __spreadArray(to, from, pack) {
|
|
259
|
-
if (pack || arguments.length === 2)
|
|
260
|
-
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
261
|
-
if (ar || !(i in from)) {
|
|
262
|
-
if (!ar)
|
|
263
|
-
ar = Array.prototype.slice.call(from, 0, i);
|
|
264
|
-
ar[i] = from[i];
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
268
|
-
}
|
|
269
|
-
function __await(v) {
|
|
270
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
271
|
-
}
|
|
272
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
273
|
-
if (!Symbol.asyncIterator)
|
|
274
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
275
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
276
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
277
|
-
function verb(n) { if (g[n])
|
|
278
|
-
i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
279
|
-
function resume(n, v) { try {
|
|
280
|
-
step(g[n](v));
|
|
281
|
-
}
|
|
282
|
-
catch (e) {
|
|
283
|
-
settle(q[0][3], e);
|
|
284
|
-
} }
|
|
285
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
286
|
-
function fulfill(value) { resume("next", value); }
|
|
287
|
-
function reject(value) { resume("throw", value); }
|
|
288
|
-
function settle(f, v) { if (f(v), q.shift(), q.length)
|
|
289
|
-
resume(q[0][0], q[0][1]); }
|
|
290
|
-
}
|
|
291
|
-
function __asyncDelegator(o) {
|
|
292
|
-
var i, p;
|
|
293
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
294
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
295
|
-
}
|
|
296
|
-
function __asyncValues(o) {
|
|
297
|
-
if (!Symbol.asyncIterator)
|
|
298
|
-
throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
299
|
-
var m = o[Symbol.asyncIterator], i;
|
|
300
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
301
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
302
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
|
|
303
|
-
}
|
|
304
|
-
function __makeTemplateObject(cooked, raw) {
|
|
305
|
-
if (Object.defineProperty) {
|
|
306
|
-
Object.defineProperty(cooked, "raw", { value: raw });
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
cooked.raw = raw;
|
|
310
|
-
}
|
|
311
|
-
return cooked;
|
|
312
|
-
}
|
|
313
|
-
;
|
|
314
|
-
var __setModuleDefault = Object.create ? (function (o, v) {
|
|
315
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
316
|
-
}) : function (o, v) {
|
|
317
|
-
o["default"] = v;
|
|
318
|
-
};
|
|
319
|
-
function __importStar(mod) {
|
|
320
|
-
if (mod && mod.__esModule)
|
|
321
|
-
return mod;
|
|
322
|
-
var result = {};
|
|
323
|
-
if (mod != null)
|
|
324
|
-
for (var k in mod)
|
|
325
|
-
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
326
|
-
__createBinding(result, mod, k);
|
|
327
|
-
__setModuleDefault(result, mod);
|
|
328
|
-
return result;
|
|
329
|
-
}
|
|
330
|
-
function __importDefault(mod) {
|
|
331
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
332
|
-
}
|
|
333
|
-
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
334
|
-
if (kind === "a" && !f)
|
|
335
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
336
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
337
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
338
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
339
|
-
}
|
|
340
|
-
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
341
|
-
if (kind === "m")
|
|
342
|
-
throw new TypeError("Private method is not writable");
|
|
343
|
-
if (kind === "a" && !f)
|
|
344
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
345
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
346
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
347
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
var moment = _rollupMoment__default['default'] || _rollupMoment__namespace;
|
|
351
|
-
/** InjectionToken for moment date adapter to configure options. */
|
|
352
|
-
var MAT_MOMENT_DATE_ADAPTER_OPTIONS = new core.InjectionToken('MAT_MOMENT_DATE_ADAPTER_OPTIONS', {
|
|
353
|
-
providedIn: 'root',
|
|
354
|
-
factory: MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY
|
|
355
|
-
});
|
|
356
|
-
/** @docs-private */
|
|
357
|
-
function MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY() {
|
|
358
|
-
return {
|
|
359
|
-
useUtc: false
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
/** Creates an array and fills it with values. */
|
|
363
|
-
function range(length, valueFunction) {
|
|
364
|
-
var valuesArray = Array(length);
|
|
365
|
-
for (var i = 0; i < length; i++) {
|
|
366
|
-
valuesArray[i] = valueFunction(i);
|
|
367
|
-
}
|
|
368
|
-
return valuesArray;
|
|
369
|
-
}
|
|
370
|
-
/** Adapts Moment.js Dates for use with Angular Material. */
|
|
371
|
-
var MomentDateAdapter = /** @class */ (function (_super) {
|
|
372
|
-
__extends(MomentDateAdapter, _super);
|
|
373
|
-
function MomentDateAdapter(dateLocale, _options) {
|
|
374
|
-
var _this = _super.call(this) || this;
|
|
375
|
-
_this._options = _options;
|
|
376
|
-
_this.setLocale(dateLocale || moment.locale());
|
|
377
|
-
return _this;
|
|
378
|
-
}
|
|
379
|
-
MomentDateAdapter.prototype.setLocale = function (locale) {
|
|
380
|
-
var _this = this;
|
|
381
|
-
_super.prototype.setLocale.call(this, locale);
|
|
382
|
-
var momentLocaleData = moment.localeData(locale);
|
|
383
|
-
this._localeData = {
|
|
384
|
-
firstDayOfWeek: momentLocaleData.firstDayOfWeek(),
|
|
385
|
-
longMonths: momentLocaleData.months(),
|
|
386
|
-
shortMonths: momentLocaleData.monthsShort(),
|
|
387
|
-
dates: range(31, function (i) { return _this.createDate(2017, 0, i + 1).format('D'); }),
|
|
388
|
-
longDaysOfWeek: momentLocaleData.weekdays(),
|
|
389
|
-
shortDaysOfWeek: momentLocaleData.weekdaysShort(),
|
|
390
|
-
narrowDaysOfWeek: momentLocaleData.weekdaysMin(),
|
|
391
|
-
};
|
|
392
|
-
};
|
|
393
|
-
MomentDateAdapter.prototype.getYear = function (date) {
|
|
394
|
-
return this.clone(date).year();
|
|
395
|
-
};
|
|
396
|
-
MomentDateAdapter.prototype.getMonth = function (date) {
|
|
397
|
-
return this.clone(date).month();
|
|
398
|
-
};
|
|
399
|
-
MomentDateAdapter.prototype.getDate = function (date) {
|
|
400
|
-
return this.clone(date).date();
|
|
401
|
-
};
|
|
402
|
-
MomentDateAdapter.prototype.getDayOfWeek = function (date) {
|
|
403
|
-
return this.clone(date).day();
|
|
404
|
-
};
|
|
405
|
-
MomentDateAdapter.prototype.getMonthNames = function (style) {
|
|
406
|
-
// Moment.js doesn't support narrow month names, so we just use short if narrow is requested.
|
|
407
|
-
return style == 'long' ? this._localeData.longMonths : this._localeData.shortMonths;
|
|
408
|
-
};
|
|
409
|
-
MomentDateAdapter.prototype.getDateNames = function () {
|
|
410
|
-
return this._localeData.dates;
|
|
411
|
-
};
|
|
412
|
-
MomentDateAdapter.prototype.getDayOfWeekNames = function (style) {
|
|
413
|
-
if (style == 'long') {
|
|
414
|
-
return this._localeData.longDaysOfWeek;
|
|
415
|
-
}
|
|
416
|
-
if (style == 'short') {
|
|
417
|
-
return this._localeData.shortDaysOfWeek;
|
|
418
|
-
}
|
|
419
|
-
return this._localeData.narrowDaysOfWeek;
|
|
420
|
-
};
|
|
421
|
-
MomentDateAdapter.prototype.getYearName = function (date) {
|
|
422
|
-
return this.clone(date).format('YYYY');
|
|
423
|
-
};
|
|
424
|
-
MomentDateAdapter.prototype.getFirstDayOfWeek = function () {
|
|
425
|
-
return this._localeData.firstDayOfWeek;
|
|
426
|
-
};
|
|
427
|
-
MomentDateAdapter.prototype.getNumDaysInMonth = function (date) {
|
|
428
|
-
return this.clone(date).daysInMonth();
|
|
429
|
-
};
|
|
430
|
-
MomentDateAdapter.prototype.clone = function (date) {
|
|
431
|
-
return date.clone().locale(this.locale);
|
|
432
|
-
};
|
|
433
|
-
MomentDateAdapter.prototype.createDate = function (year, month, date) {
|
|
434
|
-
// Moment.js will create an invalid date if any of the components are out of bounds, but we
|
|
435
|
-
// explicitly check each case so we can throw more descriptive errors.
|
|
436
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
|
437
|
-
if (month < 0 || month > 11) {
|
|
438
|
-
throw Error("Invalid month index \"" + month + "\". Month index has to be between 0 and 11.");
|
|
439
|
-
}
|
|
440
|
-
if (date < 1) {
|
|
441
|
-
throw Error("Invalid date \"" + date + "\". Date has to be greater than 0.");
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
var result = this._createMoment({ year: year, month: month, date: date }).locale(this.locale);
|
|
445
|
-
// If the result isn't valid, the date must have been out of bounds for this month.
|
|
446
|
-
if (!result.isValid() && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
447
|
-
throw Error("Invalid date \"" + date + "\" for month with index \"" + month + "\".");
|
|
448
|
-
}
|
|
449
|
-
return result;
|
|
450
|
-
};
|
|
451
|
-
MomentDateAdapter.prototype.today = function () {
|
|
452
|
-
return this._createMoment().locale(this.locale);
|
|
453
|
-
};
|
|
454
|
-
MomentDateAdapter.prototype.parse = function (value, parseFormat) {
|
|
455
|
-
if (value && typeof value == 'string') {
|
|
456
|
-
return this._createMoment(value, parseFormat, this.locale);
|
|
457
|
-
}
|
|
458
|
-
return value ? this._createMoment(value).locale(this.locale) : null;
|
|
459
|
-
};
|
|
460
|
-
MomentDateAdapter.prototype.format = function (date, displayFormat) {
|
|
461
|
-
date = this.clone(date);
|
|
462
|
-
if (!this.isValid(date) && (typeof ngDevMode === 'undefined' || ngDevMode)) {
|
|
463
|
-
throw Error('MomentDateAdapter: Cannot format invalid date.');
|
|
464
|
-
}
|
|
465
|
-
return date.format(displayFormat);
|
|
466
|
-
};
|
|
467
|
-
MomentDateAdapter.prototype.addCalendarYears = function (date, years) {
|
|
468
|
-
return this.clone(date).add({ years: years });
|
|
469
|
-
};
|
|
470
|
-
MomentDateAdapter.prototype.addCalendarMonths = function (date, months) {
|
|
471
|
-
return this.clone(date).add({ months: months });
|
|
472
|
-
};
|
|
473
|
-
MomentDateAdapter.prototype.addCalendarDays = function (date, days) {
|
|
474
|
-
return this.clone(date).add({ days: days });
|
|
475
|
-
};
|
|
476
|
-
MomentDateAdapter.prototype.toIso8601 = function (date) {
|
|
477
|
-
return this.clone(date).format();
|
|
478
|
-
};
|
|
479
|
-
/**
|
|
480
|
-
* Returns the given value if given a valid Moment or null. Deserializes valid ISO 8601 strings
|
|
481
|
-
* (https://www.ietf.org/rfc/rfc3339.txt) and valid Date objects into valid Moments and empty
|
|
482
|
-
* string into null. Returns an invalid date for all other values.
|
|
483
|
-
*/
|
|
484
|
-
MomentDateAdapter.prototype.deserialize = function (value) {
|
|
485
|
-
var date;
|
|
486
|
-
if (value instanceof Date) {
|
|
487
|
-
date = this._createMoment(value).locale(this.locale);
|
|
488
|
-
}
|
|
489
|
-
else if (this.isDateInstance(value)) {
|
|
490
|
-
// Note: assumes that cloning also sets the correct locale.
|
|
491
|
-
return this.clone(value);
|
|
492
|
-
}
|
|
493
|
-
if (typeof value === 'string') {
|
|
494
|
-
if (!value) {
|
|
495
|
-
return null;
|
|
496
|
-
}
|
|
497
|
-
date = this._createMoment(value, moment.ISO_8601).locale(this.locale);
|
|
498
|
-
}
|
|
499
|
-
if (date && this.isValid(date)) {
|
|
500
|
-
return this._createMoment(date).locale(this.locale);
|
|
501
|
-
}
|
|
502
|
-
return _super.prototype.deserialize.call(this, value);
|
|
503
|
-
};
|
|
504
|
-
MomentDateAdapter.prototype.isDateInstance = function (obj) {
|
|
505
|
-
return moment.isMoment(obj);
|
|
506
|
-
};
|
|
507
|
-
MomentDateAdapter.prototype.isValid = function (date) {
|
|
508
|
-
return this.clone(date).isValid();
|
|
509
|
-
};
|
|
510
|
-
MomentDateAdapter.prototype.invalid = function () {
|
|
511
|
-
return moment.invalid();
|
|
512
|
-
};
|
|
513
|
-
/** Creates a Moment instance while respecting the current UTC settings. */
|
|
514
|
-
MomentDateAdapter.prototype._createMoment = function (date, format, locale) {
|
|
515
|
-
var _a = this._options || {}, strict = _a.strict, useUtc = _a.useUtc;
|
|
516
|
-
return useUtc
|
|
517
|
-
? moment.utc(date, format, locale, strict)
|
|
518
|
-
: moment(date, format, locale, strict);
|
|
519
|
-
};
|
|
520
|
-
return MomentDateAdapter;
|
|
521
|
-
}(core$1.DateAdapter));
|
|
522
|
-
MomentDateAdapter.decorators = [
|
|
523
|
-
{ type: core.Injectable }
|
|
524
|
-
];
|
|
525
|
-
MomentDateAdapter.ctorParameters = function () { return [
|
|
526
|
-
{ type: String, decorators: [{ type: core.Optional }, { type: core.Inject, args: [core$1.MAT_DATE_LOCALE,] }] },
|
|
527
|
-
{ type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [MAT_MOMENT_DATE_ADAPTER_OPTIONS,] }] }
|
|
528
|
-
]; };
|
|
529
|
-
|
|
530
|
-
/**
|
|
531
|
-
* @license
|
|
532
|
-
* Copyright Google LLC All Rights Reserved.
|
|
533
|
-
*
|
|
534
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
535
|
-
* found in the LICENSE file at https://angular.io/license
|
|
536
|
-
*/
|
|
537
|
-
var MAT_MOMENT_DATE_FORMATS = {
|
|
538
|
-
parse: {
|
|
539
|
-
dateInput: 'l',
|
|
540
|
-
},
|
|
541
|
-
display: {
|
|
542
|
-
dateInput: 'l',
|
|
543
|
-
monthYearLabel: 'MMM YYYY',
|
|
544
|
-
dateA11yLabel: 'LL',
|
|
545
|
-
monthYearA11yLabel: 'MMMM YYYY',
|
|
546
|
-
},
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
/**
|
|
550
|
-
* @license
|
|
551
|
-
* Copyright Google LLC All Rights Reserved.
|
|
552
|
-
*
|
|
553
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
554
|
-
* found in the LICENSE file at https://angular.io/license
|
|
555
|
-
*/
|
|
556
|
-
var MomentDateModule = /** @class */ (function () {
|
|
557
|
-
function MomentDateModule() {
|
|
558
|
-
}
|
|
559
|
-
return MomentDateModule;
|
|
560
|
-
}());
|
|
561
|
-
MomentDateModule.decorators = [
|
|
562
|
-
{ type: core.NgModule, args: [{
|
|
563
|
-
providers: [
|
|
564
|
-
{
|
|
565
|
-
provide: core$1.DateAdapter,
|
|
566
|
-
useClass: MomentDateAdapter,
|
|
567
|
-
deps: [core$1.MAT_DATE_LOCALE, MAT_MOMENT_DATE_ADAPTER_OPTIONS]
|
|
568
|
-
}
|
|
569
|
-
],
|
|
570
|
-
},] }
|
|
571
|
-
];
|
|
572
|
-
var ɵ0 = MAT_MOMENT_DATE_FORMATS;
|
|
573
|
-
var MatMomentDateModule = /** @class */ (function () {
|
|
574
|
-
function MatMomentDateModule() {
|
|
575
|
-
}
|
|
576
|
-
return MatMomentDateModule;
|
|
577
|
-
}());
|
|
578
|
-
MatMomentDateModule.decorators = [
|
|
579
|
-
{ type: core.NgModule, args: [{
|
|
580
|
-
imports: [MomentDateModule],
|
|
581
|
-
providers: [{ provide: core$1.MAT_DATE_FORMATS, useValue: ɵ0 }],
|
|
582
|
-
},] }
|
|
583
|
-
];
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* @license
|
|
587
|
-
* Copyright Google LLC All Rights Reserved.
|
|
588
|
-
*
|
|
589
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
590
|
-
* found in the LICENSE file at https://angular.io/license
|
|
591
|
-
*/
|
|
592
|
-
|
|
593
|
-
/**
|
|
594
|
-
* Generated bundle index. Do not edit.
|
|
595
|
-
*/
|
|
596
|
-
|
|
597
|
-
exports.MAT_MOMENT_DATE_ADAPTER_OPTIONS = MAT_MOMENT_DATE_ADAPTER_OPTIONS;
|
|
598
|
-
exports.MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY = MAT_MOMENT_DATE_ADAPTER_OPTIONS_FACTORY;
|
|
599
|
-
exports.MAT_MOMENT_DATE_FORMATS = MAT_MOMENT_DATE_FORMATS;
|
|
600
|
-
exports.MatMomentDateModule = MatMomentDateModule;
|
|
601
|
-
exports.MomentDateAdapter = MomentDateAdapter;
|
|
602
|
-
exports.MomentDateModule = MomentDateModule;
|
|
603
|
-
exports.ɵ0 = ɵ0;
|
|
604
|
-
|
|
605
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
606
|
-
|
|
607
|
-
})));
|
|
608
|
-
//# sourceMappingURL=material-moment-adapter.umd.js.map
|