@contentful/field-editor-date 1.6.29 → 1.7.1
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.
|
@@ -58,7 +58,8 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
58
58
|
}
|
|
59
59
|
return newObj;
|
|
60
60
|
}
|
|
61
|
-
const
|
|
61
|
+
const YEARS_INTO_FUTURE = 100;
|
|
62
|
+
const MIN_YEAR = '1000';
|
|
62
63
|
const styles = {
|
|
63
64
|
root: (0, _emotion.css)({
|
|
64
65
|
maxWidth: '270px'
|
|
@@ -66,10 +67,9 @@ const styles = {
|
|
|
66
67
|
};
|
|
67
68
|
const DatepickerInput = (props)=>{
|
|
68
69
|
const [fromDate, toDate] = (0, _react.useMemo)(()=>{
|
|
69
|
-
const fromDate = new Date();
|
|
70
|
-
fromDate.setFullYear(fromDate.getFullYear() - YEAR_RANGE);
|
|
70
|
+
const fromDate = new Date(MIN_YEAR);
|
|
71
71
|
const toDate = new Date();
|
|
72
|
-
toDate.setFullYear(toDate.getFullYear() +
|
|
72
|
+
toDate.setFullYear(toDate.getFullYear() + YEARS_INTO_FUTURE);
|
|
73
73
|
return [
|
|
74
74
|
fromDate,
|
|
75
75
|
toDate
|
|
@@ -2,7 +2,8 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import { Datepicker } from '@contentful/f36-components';
|
|
3
3
|
import { css } from 'emotion';
|
|
4
4
|
import moment from 'moment';
|
|
5
|
-
const
|
|
5
|
+
const YEARS_INTO_FUTURE = 100;
|
|
6
|
+
const MIN_YEAR = '1000';
|
|
6
7
|
const styles = {
|
|
7
8
|
root: css({
|
|
8
9
|
maxWidth: '270px'
|
|
@@ -10,10 +11,9 @@ const styles = {
|
|
|
10
11
|
};
|
|
11
12
|
export const DatepickerInput = (props)=>{
|
|
12
13
|
const [fromDate, toDate] = useMemo(()=>{
|
|
13
|
-
const fromDate = new Date();
|
|
14
|
-
fromDate.setFullYear(fromDate.getFullYear() - YEAR_RANGE);
|
|
14
|
+
const fromDate = new Date(MIN_YEAR);
|
|
15
15
|
const toDate = new Date();
|
|
16
|
-
toDate.setFullYear(toDate.getFullYear() +
|
|
16
|
+
toDate.setFullYear(toDate.getFullYear() + YEARS_INTO_FUTURE);
|
|
17
17
|
return [
|
|
18
18
|
fromDate,
|
|
19
19
|
toDate
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-date",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"registry": "https://npm.pkg.github.com/"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "a14e400cb993295bc478cecb8cc49df8c83a90bc"
|
|
58
58
|
}
|