New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

@contentful/field-editor-date

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@contentful/field-editor-date - npm Package Compare versions

Comparing version

to
1.7.1

@@ -11,3 +11,3 @@ "use strict";

});
const _react = _interop_require_default(require("react"));
const _react = _interop_require_wildcard(require("react"));
const _f36components = require("@contentful/f36-components");

@@ -21,2 +21,45 @@ const _emotion = require("emotion");

}
function _getRequireWildcardCache(nodeInterop) {
if (typeof WeakMap !== "function") return null;
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
return (_getRequireWildcardCache = function(nodeInterop) {
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
})(nodeInterop);
}
function _interop_require_wildcard(obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return {
default: obj
};
}
var cache = _getRequireWildcardCache(nodeInterop);
if (cache && cache.has(obj)) {
return cache.get(obj);
}
var newObj = {
__proto__: null
};
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
for(var key in obj){
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
if (desc && (desc.get || desc.set)) {
Object.defineProperty(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
newObj.default = obj;
if (cache) {
cache.set(obj, newObj);
}
return newObj;
}
const YEARS_INTO_FUTURE = 100;
const MIN_YEAR = '1000';
const styles = {

@@ -28,2 +71,11 @@ root: (0, _emotion.css)({

const DatepickerInput = (props)=>{
const [fromDate, toDate] = (0, _react.useMemo)(()=>{
const fromDate = new Date(MIN_YEAR);
const toDate = new Date();
toDate.setFullYear(toDate.getFullYear() + YEARS_INTO_FUTURE);
return [
fromDate,
toDate
];
}, []);
const dateObj = props.value?.toObject();

@@ -41,4 +93,6 @@ const selectedDate = dateObj ? new Date(dateObj.years, dateObj.months, dateObj.date) : undefined;

placeholder: ''
}
},
fromDate: fromDate,
toDate: toDate
});
};

@@ -1,5 +0,7 @@

import React from 'react';
import React, { useMemo } from 'react';
import { Datepicker } from '@contentful/f36-components';
import { css } from 'emotion';
import moment from 'moment';
const YEARS_INTO_FUTURE = 100;
const MIN_YEAR = '1000';
const styles = {

@@ -11,2 +13,11 @@ root: css({

export const DatepickerInput = (props)=>{
const [fromDate, toDate] = useMemo(()=>{
const fromDate = new Date(MIN_YEAR);
const toDate = new Date();
toDate.setFullYear(toDate.getFullYear() + YEARS_INTO_FUTURE);
return [
fromDate,
toDate
];
}, []);
const dateObj = props.value?.toObject();

@@ -24,4 +35,6 @@ const selectedDate = dateObj ? new Date(dateObj.years, dateObj.months, dateObj.date) : undefined;

placeholder: ''
}
},
fromDate: fromDate,
toDate: toDate
});
};
{
"name": "@contentful/field-editor-date",
"version": "1.7.0",
"version": "1.7.1",
"main": "dist/cjs/index.js",

@@ -57,3 +57,3 @@ "module": "dist/esm/index.js",

},
"gitHead": "b533366fc5633e288dee85a7c5584d7fa0100ded"
"gitHead": "a14e400cb993295bc478cecb8cc49df8c83a90bc"
}