Skip to content

Commit b47f6fc

Browse files
committed
2 parents 85b085b + f9ac13a commit b47f6fc

File tree

8 files changed

+62
-24
lines changed

8 files changed

+62
-24
lines changed

README.md

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
## install dependencies
1+
# React Datepicker
22

3-
npm i -D @types/node @types/react @types/react-dom @shinyongjun/eslint-config eslint prettier react react-dom typescript -w test
3+
![Datepicker](https://github.com/shinyj1991/react-datepicker/raw/main/package/public/readme-2.jpg)
44

5-
npm i -D @types/node @types/react @types/react-dom @shinyongjun/eslint-config eslint prettier react react-dom typescript concurrently cpy-cli -w package
5+
Example - [Link](https://shinyongjun.com/react-datepicker/example)
66

7-
## React Datepicker
7+
Document - [Link](https://shinyongjun.com/react-datepicker/document)
88

9-
[NPM](https://www.npmjs.com/package/@shinyongjun/react-datepicker)
9+
Issues - [Link](https://github.com/shinyj1991/react-datepicker/issues)
1010

11-
## Timezone
12-
13-
```js
14-
// 인수가 문자열 타임스태프 일땐 Month를 1부터 카운트한다. UTC를 기준으로 하기때문에 한국 기준 9시를 반환한다.
15-
const NEW_DATE1 = new Date('2023-09-01');
16-
const NEW_DATE2 = new Date('2023-09-01 17:15:00');
17-
// 인수가 숫자형일땐 Month를 0부터 카운트한다. 시간을 생략하면 00시00분00초를 기준으로 한다.
18-
const NEW_DATE3 = new Date(2023, 9, 1);
19-
const NEW_DATE4 = new Date(2023, 9, 1, 12, 0, 0);
20-
// Z를 붙이면 UCT 기준 표준시 (Javascript에서 UCT와 GMT는 같다)
21-
const NEW_DATE5 = new Date('2023-09-03T00:00:00Z'); // new Date("2023-09-01") 과 같다.
22-
// Z를 생략하면 LOCAL TIME ZONE
23-
const NEW_DATE6 = new Date('2023-09-03T00:00:00');
24-
```
11+
NPM - [NPM](https://www.npmjs.com/package/@shinyongjun/react-datepicker)

package/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@shinyongjun/react-datepicker",
3-
"version": "1.9.0",
3+
"version": "1.11.0",
44
"main": "./dist/cjs/index.js",
55
"module": "./dist/esm/index.js",
66
"source": "./src/index.tsx",

package/src/components/Datepicker.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ interface IProps {
2323
closesAfterChange?: boolean;
2424
weekdayLabels?: string[];
2525
withPortal?: boolean;
26+
className?: string;
27+
placeholder?: string;
28+
disabled?: boolean;
2629
onChange?: (activeDate: Date | null) => void;
2730
}
2831

@@ -35,6 +38,9 @@ function Datepicker({
3538
closesAfterChange = true,
3639
weekdayLabels = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
3740
withPortal = false,
41+
className = '',
42+
placeholder = '',
43+
disabled = false,
3844
onChange,
3945
}: IProps) {
4046
// 인수가 없을 땐 LOCAL 기준 현재 시간을 반환한다.
@@ -67,13 +73,15 @@ function Datepicker({
6773
}, [value, onChange, setViewDate]);
6874

6975
return (
70-
<div className={`${NAME_SPACE}__wrapper`}>
76+
<div className={`${NAME_SPACE}__wrapper ${className}`}>
7177
<InputDate
7278
value={value}
73-
setValue={setValue}
7479
valueFormat={valueFormat}
75-
setIsVisible={setIsVisible}
7680
useClearButton={useClearButton}
81+
placeholder={placeholder}
82+
disabled={disabled}
83+
setValue={setValue}
84+
setIsVisible={setIsVisible}
7785
/>
7886
<Layer
7987
isVisible={isVisible}

package/src/components/Rangepicker.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ interface IProps {
2525
closesAfterChange?: boolean;
2626
weekdayLabels?: string[];
2727
withPortal?: boolean;
28+
className?: string;
29+
placeholder?: string;
30+
disabled?: boolean;
2831
onChange?: (startDate: Date | null, endDate: Date | null) => void;
2932
}
3033

@@ -38,6 +41,9 @@ function Rangepicker({
3841
closesAfterChange = true,
3942
weekdayLabels = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
4043
withPortal = false,
44+
className = '',
45+
placeholder = '',
46+
disabled = false,
4147
onChange,
4248
}: IProps) {
4349
// 인수가 없을 땐 LOCAL 기준 현재 시간을 반환한다.
@@ -76,12 +82,14 @@ function Rangepicker({
7682
}, [startValue, endValue, onChange]);
7783

7884
return (
79-
<div className={`${NAME_SPACE}__wrapper`}>
85+
<div className={`${NAME_SPACE}__wrapper ${className}`}>
8086
<InputRange
8187
startValue={startValue}
8288
endValue={endValue}
8389
valueFormat={valueFormat}
8490
useClearButton={useClearButton}
91+
placeholder={placeholder}
92+
disabled={disabled}
8593
setIsVisible={setIsVisible}
8694
setStartValue={setStartValue}
8795
setEndValue={setEndValue}

package/src/components/input/Date.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ interface IProps {
88
value: Date | null;
99
valueFormat: string;
1010
useClearButton: boolean;
11+
placeholder: string;
12+
disabled: boolean;
1113
setValue: (value: Date | null) => void;
1214
setIsVisible: (value: boolean) => void;
1315
}
@@ -16,6 +18,8 @@ function InputDate({
1618
value,
1719
valueFormat,
1820
useClearButton,
21+
placeholder,
22+
disabled,
1923
setValue,
2024
setIsVisible,
2125
}: IProps) {
@@ -30,6 +34,8 @@ function InputDate({
3034
type="text"
3135
value={formatDate(value, valueFormat)}
3236
readOnly
37+
placeholder={placeholder}
38+
disabled={disabled}
3339
onFocus={handleFocus}
3440
/>
3541
{useClearButton && value && (

package/src/components/input/Range.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ interface IProps {
99
endValue: Date | null;
1010
valueFormat: string;
1111
useClearButton: boolean;
12+
placeholder: string;
13+
disabled: boolean;
1214
setStartValue: (value: Date | null) => void;
1315
setEndValue: (value: Date | null) => void;
1416
setIsVisible: (value: boolean) => void;
@@ -19,6 +21,8 @@ function InputRange({
1921
endValue,
2022
valueFormat,
2123
useClearButton,
24+
placeholder,
25+
disabled,
2226
setStartValue,
2327
setEndValue,
2428
setIsVisible,
@@ -50,6 +54,8 @@ function InputRange({
5054
type="text"
5155
value={setRangeValue()}
5256
readOnly
57+
placeholder={placeholder}
58+
disabled={disabled}
5359
onFocus={handleFocus}
5460
/>
5561
{useClearButton && (startValue || endValue) && (

test/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## install dependencies
2+
3+
npm i -D @types/node @types/react @types/react-dom @shinyongjun/eslint-config eslint prettier react react-dom typescript -w test
4+
5+
npm i -D @types/node @types/react @types/react-dom @shinyongjun/eslint-config eslint prettier react react-dom typescript concurrently cpy-cli -w package
6+
7+
## React Datepicker
8+
9+
## Timezone
10+
11+
```js
12+
// 인수가 문자열 타임스태프 일땐 Month를 1부터 카운트한다. UTC를 기준으로 하기때문에 한국 기준 9시를 반환한다.
13+
const NEW_DATE1 = new Date('2023-09-01');
14+
const NEW_DATE2 = new Date('2023-09-01 17:15:00');
15+
// 인수가 숫자형일땐 Month를 0부터 카운트한다. 시간을 생략하면 00시00분00초를 기준으로 한다.
16+
const NEW_DATE3 = new Date(2023, 9, 1);
17+
const NEW_DATE4 = new Date(2023, 9, 1, 12, 0, 0);
18+
// Z를 붙이면 UCT 기준 표준시 (Javascript에서 UCT와 GMT는 같다)
19+
const NEW_DATE5 = new Date('2023-09-03T00:00:00Z'); // new Date("2023-09-01") 과 같다.
20+
// Z를 생략하면 LOCAL TIME ZONE
21+
const NEW_DATE6 = new Date('2023-09-03T00:00:00');
22+
```

test/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Datepicker, Rangepicker } from '@shinyongjun/react-datepicker';
2+
import '@shinyongjun/react-datepicker/css';
23
import { useState } from 'react';
34

45
function App() {

0 commit comments

Comments
 (0)