import { convertZonedDateTimeToUTC , toUTCDate } from 'proton-shared/lib/date/timezone' ; import { DateTimeModel } from 'proton-shared/lib/interfaces/calendar' ; export const getDateTimeState = ( utcDate , tzid ) : DateTimeModel => { return { date : new Date ( utcDate . getUTCFullYear ( ) , utcDate . getUTCMonth ( ) , utcDate . getUTCDate ( ) , 0 , 0 ) , time : new Date ( 2000 , 0 , 1 , utcDate . getUTCHours ( ) , utcDate . getUTCMinutes ( ) ) , tzid , } ; } ; export const getDateTime = ( { date , time } ) => { return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) , time . getHours ( ) , time . getMinutes ( ) ) ; } ; export const getTimeInUtc = ( { date , time , tzid } , isAllDay ) => { if ( isAllDay ) { return toUTCDate ( { year : date . getFullYear ( ) , month : date . getMonth ( ) + 1 , day : date . getDate ( ) , } ) ; } return toUTCDate ( convertZonedDateTimeToUTC ( { year : date . getFullYear ( ) , month : date . getMonth ( ) + 1 , day : date . getDate ( ) , hours : time . getHours ( ) , minutes : time . getMinutes ( ) , seconds : 0 , } , tzid ) ) ; } ;