File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change 2323- ✅ Shortcuts
2424- ✅ TypeScript support
2525- ✅ Localization(i18n)
26+ - ✅ Date formatting
2627- ⬜ Disable specific dates
2728- ⬜ Custom shortcuts
2829
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ interface Props {
4646 disabled ?: boolean ;
4747 inputClassName ?: string | null ;
4848 containerClassName ?: string | null ;
49+ displayFormat ?: string ;
4950 readonly ?: boolean ;
5051}
5152
@@ -65,6 +66,7 @@ const Datepicker: React.FC<Props> = ({
6566 disabled = false ,
6667 inputClassName = null ,
6768 containerClassName = null ,
69+ displayFormat = "YYYY-MM-DD" ,
6870 readonly = false
6971} ) => {
7072 // Ref
@@ -216,7 +218,9 @@ const Datepicker: React.FC<Props> = ({
216218 end : formatDate ( endDate )
217219 } ) ;
218220 setInputText (
219- `${ formatDate ( startDate ) } ${ asSingle ? "" : ` ~ ${ formatDate ( endDate ) } ` } `
221+ `${ formatDate ( startDate , displayFormat ) } ${
222+ asSingle ? "" : ` ~ ${ formatDate ( endDate , displayFormat ) } `
223+ } `
220224 ) ;
221225 }
222226 }
@@ -227,7 +231,7 @@ const Datepicker: React.FC<Props> = ({
227231 end : null
228232 } ) ;
229233 }
230- } , [ asSingle , value ] ) ;
234+ } , [ asSingle , value , displayFormat ] ) ;
231235
232236 // Variable
233237 const colorPrimary = useMemo ( ( ) => {
You can’t perform that action at this time.
0 commit comments