UNPKG

2.61 kBJavaScriptView Raw
1"use strict";
2/*
3 * Copyright 2016 Palantir Technologies, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.combineModifiers = exports.getDefaultMinDate = exports.getDefaultMaxDate = exports.DISALLOWED_MODIFIERS = exports.SELECTED_RANGE_MODIFIER = exports.SELECTED_MODIFIER = exports.OUTSIDE_MODIFIER = exports.HOVERED_RANGE_MODIFIER = exports.DISABLED_MODIFIER = void 0;
19var months_1 = require("./common/months");
20exports.DISABLED_MODIFIER = "disabled";
21exports.HOVERED_RANGE_MODIFIER = "hovered-range";
22exports.OUTSIDE_MODIFIER = "outside";
23exports.SELECTED_MODIFIER = "selected";
24exports.SELECTED_RANGE_MODIFIER = "selected-range";
25// modifiers the user can't set because they are used by Blueprint or react-day-picker
26exports.DISALLOWED_MODIFIERS = [
27 exports.DISABLED_MODIFIER,
28 exports.HOVERED_RANGE_MODIFIER,
29 exports.OUTSIDE_MODIFIER,
30 exports.SELECTED_MODIFIER,
31 exports.SELECTED_RANGE_MODIFIER,
32];
33function getDefaultMaxDate() {
34 var date = new Date();
35 date.setMonth(date.getMonth() + 6);
36 return date;
37}
38exports.getDefaultMaxDate = getDefaultMaxDate;
39function getDefaultMinDate() {
40 var date = new Date();
41 date.setFullYear(date.getFullYear() - 20);
42 date.setMonth(months_1.Months.JANUARY, 1);
43 return date;
44}
45exports.getDefaultMinDate = getDefaultMinDate;
46function combineModifiers(baseModifiers, userModifiers) {
47 var modifiers = baseModifiers;
48 if (userModifiers != null) {
49 modifiers = {};
50 for (var _i = 0, _a = Object.keys(userModifiers); _i < _a.length; _i++) {
51 var key = _a[_i];
52 if (exports.DISALLOWED_MODIFIERS.indexOf(key) === -1) {
53 modifiers[key] = userModifiers[key];
54 }
55 }
56 for (var _b = 0, _c = Object.keys(baseModifiers); _b < _c.length; _b++) {
57 var key = _c[_b];
58 modifiers[key] = baseModifiers[key];
59 }
60 }
61 return modifiers;
62}
63exports.combineModifiers = combineModifiers;
64//# sourceMappingURL=datePickerCore.js.map
\No newline at end of file