<div
style={{
marginLeft: `auto`,
marginRight: `auto`,
maxWidth: rhythm(24),
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
}}
>
import { rhythm, scale } from "../utils/typography"
export const rhythm = typography.rhythm
import Wordpress2016 from "typography-theme-wordpress-2016"
const typography = new Typography(Wordpress2016)
Wordpress2016.overrideThemeStyles = () => {
return {
"a.gatsby-resp-image-link": {
boxShadow: `none`,
},
}
}
handlerInputChange = (event) => {
console.log('Срабатывание функции handlerInputChange ');
console.log('Переданное значение: ', event.target.value);
event.preventDefault();
this.setState({
date: null,
dateInput: event.target.value
})
let dateRegExp = /([0-9]{2}.[0-9]{2}.[0-9]{4})/,
resultMatch,
dateDelivery;
let {
minDate,
maxDate
} = this.props;
resultMatch = event.target.value.match(dateRegExp);
if (resultMatch && resultMatch.length > 0) {
console.log('Задание state');
dateDelivery = new Date(resultMatch[1].replace(/([0-9]{2}).([0-9]{2}).([0-9]{4})/, '$3-$2-$1'));
if (dateDelivery && (minDate && dateDelivery < minDate || maxDate && dateDelivery > maxDate)) {
console.log('Ошибка');
return false;
}
this.setState({
date: moment(dateDelivery),
dateInput: resultMatch[1]
});
this.props.onChange(resultMatch[1] ? resultMatch[1] : "");
}
}