Skip to content

Commit f30fdc8

Browse files
committed
Updated and fixed lint issues
1 parent 61b7d7d commit f30fdc8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Datepicker.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from "react";
1+
import React, { useState, useEffect, useRef } from "react";
22
// import { LabelWrapperProps, LabelWrapper } from "./Common";
33
import {
44
Calendar as CalendarIcon,
@@ -54,7 +54,7 @@ export const RawDatePicker: React.FC<{
5454
onChange: (date: Date) => void;
5555
}> = props => {
5656
const [showCalendar, setShowCalendar] = useState(false);
57-
let popupNode: HTMLElement;
57+
const popupNode = useRef<HTMLElement>();
5858

5959
function emitSelection(date: Date) {
6060
props.onChange(date);
@@ -70,7 +70,7 @@ export const RawDatePicker: React.FC<{
7070
*/
7171
useEffect(() => {
7272
function mouseDownListener(e: MouseEvent) {
73-
if (popupNode && !popupNode.contains(e.target as Node)) {
73+
if (popupNode.current && !popupNode.current.contains(e.target as Node)) {
7474
setShowCalendar(false);
7575
}
7676
}
@@ -104,7 +104,7 @@ export const RawDatePicker: React.FC<{
104104
</div>
105105
)}
106106
</Reference>
107-
<Popper placement="bottom-start" innerRef={node => (popupNode = node)}>
107+
<Popper placement="bottom-start" innerRef={node => (popupNode.current = node)}>
108108
{({ ref, style, placement, arrowProps }) =>
109109
showCalendar ? (
110110
<Calendar
@@ -449,7 +449,7 @@ function daysInMonth(month: number, year: number) {
449449
* @param year
450450
*/
451451
function isLeapYear(year: number): boolean {
452-
return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
452+
return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
453453
}
454454

455455
/**

0 commit comments

Comments
 (0)