11import { Dialog , DialogBody , DialogFooter , Intent } from '@blueprintjs/core' ;
22import { DateInput3 } from '@blueprintjs/datetime2' ;
33import { IconNames } from '@blueprintjs/icons' ;
4- import moment from 'moment ' ;
4+ import dayjs from 'dayjs ' ;
55import React , { useCallback , useState } from 'react' ;
66
77import { AssessmentOverview } from '../../../../commons/assessment/AssessmentTypes' ;
@@ -21,10 +21,10 @@ const EditCell: React.FC<Props> = ({ data, forOpenDate, handleAssessmentChangeDa
2121 const maxDate = new Date ( 2030 , 11 , 31 ) ;
2222
2323 const currentDateString = forOpenDate ? data . openAt : data . closeAt ;
24- const currentDate = moment ( currentDateString , moment . ISO_8601 , true ) ;
24+ const currentDate = dayjs ( currentDateString , undefined , true ) ;
2525
2626 const [ isDialogOpen , setDialogState ] = useState ( false ) ;
27- const [ newDate , setNewDate ] = useState < moment . Moment | null > ( currentDate ) ;
27+ const [ newDate , setNewDate ] = useState < dayjs . Dayjs | null > ( currentDate ) ;
2828
2929 const handleOpenDialog = useCallback ( ( ) => setDialogState ( true ) , [ ] ) ;
3030 const handleCloseDialog = useCallback ( ( ) => setDialogState ( false ) , [ ] ) ;
@@ -46,13 +46,13 @@ const EditCell: React.FC<Props> = ({ data, forOpenDate, handleAssessmentChangeDa
4646 } , [ newDate , currentDate , data , handleAssessmentChangeDate , forOpenDate , handleCloseDialog ] ) ;
4747
4848 const handleParseDate = ( str : string ) => {
49- const date = moment ( str , dateDisplayFormat , true ) ;
49+ const date = dayjs ( str , dateDisplayFormat , true ) ;
5050 return date . isValid ( ) ? date . toDate ( ) : false ;
5151 } ;
52- const handleFormatDate = ( date : Date ) => moment ( date ) . format ( dateDisplayFormat ) ;
52+ const handleFormatDate = ( date : Date ) => dayjs ( date ) . format ( dateDisplayFormat ) ;
5353
5454 const handleDateChange = React . useCallback (
55- ( selectedDate : string | null ) => setNewDate ( moment ( selectedDate ) ) ,
55+ ( selectedDate : string | null ) => setNewDate ( dayjs ( selectedDate ) ) ,
5656 [ ]
5757 ) ;
5858 const handleDateError = React . useCallback ( ( ) => {
0 commit comments