diff --git a/src/components/Calendar.res b/src/components/Calendar.res index 59926c1e0..30eb93dec 100644 --- a/src/components/Calendar.res +++ b/src/components/Calendar.res @@ -68,7 +68,7 @@ module TableRow = { "00", "00", )->Date.fromString - let dateToday = Js.Date.make() + let dateToday = Date.make() let todayInitial = Js.Date.setHoursMSMs( dateToday, ~hours=0.0, @@ -78,7 +78,7 @@ module TableRow = { (), ) let isInCustomDisable = if customDisabledFutureDays > 0.0 { - date->Js.Date.getTime -. todayInitial <= + date->Date.getTime -. todayInitial <= customDisabledFutureDays *. 24.0 *. 3600.0 *. 1000.0 } else { false @@ -87,8 +87,8 @@ module TableRow = { | Some(obj) => if obj.startDate !== "" && obj.endDate !== "" { !( - date->Js.Date.getTime -. obj.startDate->Date.fromString->Js.Date.getTime >= 0.0 && - obj.endDate->Date.fromString->Js.Date.getTime -. date->Js.Date.getTime >= 0.0 + date->Date.getTime -. obj.startDate->Date.fromString->Date.getTime >= 0.0 && + obj.endDate->Date.fromString->Date.getTime -. date->Date.getTime >= 0.0 ) } else { false @@ -98,15 +98,15 @@ module TableRow = { } let isFutureDate = if disablePastDates { - todayInitial -. date->Js.Date.getTime <= 0.0 + todayInitial -. date->Date.getTime <= 0.0 } else { - todayInitial -. date->Js.Date.getTime < 0.0 + todayInitial -. date->Date.getTime < 0.0 } let isInLimit = switch dateRangeLimit { | Some(limit) => if startDate !== "" { - date->Js.Date.getTime -. startDate->Date.fromString->Js.Date.getTime < + date->Date.getTime -. startDate->Date.fromString->Date.getTime < ((limit->Js.Int.toFloat -. 1.) *. 24. *. 60. *. 60. -. 60.) *. 1000. } else { true @@ -124,7 +124,7 @@ module TableRow = { | true => switch onDateClick { | Some(fn) => - fn((Js.Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) + fn((Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) | None => () } @@ -132,7 +132,7 @@ module TableRow = { } } let hSelf = highlight( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), + (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), ) let dayClass = if ( @@ -157,13 +157,11 @@ module TableRow = { ) datevalue } - let today = (Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString).format(. - "YYYY-MM-DD", - ) + let today = (Date.make()->Date.toString->DayJs.getDayJsForString).format(. "YYYY-MM-DD") let renderingDate = ( getDate([Float.toString(year), Float.toString(month +. 1.0), obj]) - ->Js.Date.toString + ->Date.toString ->DayJs.getDayJsForString ).format(. "YYYY-MM-DD") @@ -227,9 +225,9 @@ module TableRow = { ) } let handleHover = () => { - let date = (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD") + let date = (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD") let parsedDate = getDate(String.split(date, "-")) - setHoverdDate(_ => parsedDate->Js.Date.toString) + setHoverdDate(_ => parsedDate->Date.toString) switch setShowMsg { | Some(setMsg) => if ( @@ -271,9 +269,7 @@ module TableRow = { {cellRenderer( obj == "" ? None - : Some( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), - ), + : Some((Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")), )} diff --git a/src/components/CalendarList.res b/src/components/CalendarList.res index 42c1dac61..f90688d42 100644 --- a/src/components/CalendarList.res +++ b/src/components/CalendarList.res @@ -54,13 +54,13 @@ let make = ( let startMonth = switch month { | Some(m) => Int.toFloat(Float.toInt(getMonthInFloat(m))) | None => { - let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Js.Date.make()))) + let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Date.make()))) disableFutureDates && count > 1 ? tMonth -. 1.0 : tMonth } } let startYear = switch year { | Some(y) => Int.toFloat(y) - | None => Js.Date.getFullYear(Js.Date.make()) + | None => Js.Date.getFullYear(Date.make()) } let (currDateIm, setCurrDate) = React.useState(() => Js.Date.makeWithYM(~year=startYear, ~month=startMonth, ()) diff --git a/src/components/DatePicker.res b/src/components/DatePicker.res index 186e13bae..2a47d0900 100644 --- a/src/components/DatePicker.res +++ b/src/components/DatePicker.res @@ -162,7 +162,7 @@ let make = ( onChange: timeValEv => { let timeVal = timeValEv->Identity.formReactEventToString if selectedDate !== "" { - let todayDayJsObj = Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString + let todayDayJsObj = Date.make()->Date.toString->DayJs.getDayJsForString let todayTime = todayDayJsObj.format(. "HH:mm:ss") let todayDate = todayDayJsObj.format(. "YYYY-MM-DD") let timeVal = if disableFutureDates && selectedDate == todayDate && timeVal > todayTime { diff --git a/src/components/DateRangePicker.res b/src/components/DateRangePicker.res index 7331d226f..f31ecd256 100644 --- a/src/components/DateRangePicker.res +++ b/src/components/DateRangePicker.res @@ -58,7 +58,7 @@ let getTimeStringForValue = ( } let getFormattedDate = (date, format) => { - date->Date.fromString->Js.Date.toISOString->TimeZoneHook.formattedISOString(format) + date->Date.fromString->Date.toISOString->TimeZoneHook.formattedISOString(format) } let isStartBeforeEndDate = (start, end) => { @@ -80,7 +80,7 @@ let isStartBeforeEndDate = (start, end) => { let getStartEndDiff = (startDate, endDate) => { let diffTime = Math.abs( - endDate->Date.fromString->Js.Date.getTime -. startDate->Date.fromString->Js.Date.getTime, + endDate->Date.fromString->Date.getTime -. startDate->Date.fromString->Date.getTime, ) diffTime } @@ -203,7 +203,7 @@ module Base = { let dropdownPosition = isFilterSection && !isMobileView && isCustomSelected ? "right-0" : "" let todayDayJsObj = React.useMemo1(() => { - Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString + Date.make()->Date.toString->DayJs.getDayJsForString }, [isDropdownExpanded]) let currentTime = todayDayJsObj.format(. "HH:mm") diff --git a/src/components/DynamicChart.res b/src/components/DynamicChart.res index 3d5323aa5..a0756d48c 100644 --- a/src/components/DynamicChart.res +++ b/src/components/DynamicChart.res @@ -653,7 +653,7 @@ let make = ( if sTime->String.length > 0 { let {date, hour, minute, month, second, year} = - sTime->Date.fromString->Js.Date.toISOString->isoStringToCustomTimeZone + sTime->Date.fromString->Date.toISOString->isoStringToCustomTimeZone dict->Dict.set( "time_bucket", diff --git a/src/components/DynamicSingleStat.res b/src/components/DynamicSingleStat.res index 4be75ad85..d1ae33fd7 100644 --- a/src/components/DynamicSingleStat.res +++ b/src/components/DynamicSingleStat.res @@ -269,7 +269,7 @@ let make = ( (endTimeFromUrl->DayJs.getDayJsForString).subtract(. 1, "hour", - ).toDate(.)->Js.Date.toISOString + ).toDate(.)->Date.toISOString } else { startTimeFromUrl } @@ -366,7 +366,7 @@ let make = ( (endTimeFromUrl->DayJs.getDayJsForString).subtract(. 1, "hour", - ).toDate(.)->Js.Date.toISOString + ).toDate(.)->Date.toISOString } else { startTimeFromUrl } diff --git a/src/components/InfraCalendar.res b/src/components/InfraCalendar.res index 9c3c350d2..f90d61da5 100644 --- a/src/components/InfraCalendar.res +++ b/src/components/InfraCalendar.res @@ -56,7 +56,7 @@ module TableRow = { "00", "00", )->Date.fromString - let dateToday = Js.Date.make() + let dateToday = Date.make() let todayInitial = Js.Date.setHoursMSMs( dateToday, ~hours=0.0, @@ -65,7 +65,7 @@ module TableRow = { ~milliseconds=0.0, (), ) - let isFutureDate = todayInitial -. date->Js.Date.getTime < 0.0 + let isFutureDate = todayInitial -. date->Date.getTime < 0.0 let onClick = _evt => { let isClickDisabled = isFutureDate ? disableFutureDates : disablePastDates @@ -74,7 +74,7 @@ module TableRow = { switch onDateClick { | Some(fn) => if obj !== "" { - fn((Js.Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) + fn((Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) } | None => () } @@ -82,7 +82,7 @@ module TableRow = { } } let hSelf = highlight( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), + (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), ) let dayClass = if ( @@ -159,9 +159,7 @@ module TableRow = { {cellRenderer( obj == "" ? None - : Some( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), - ), + : Some((Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")), )} @@ -188,7 +186,7 @@ let make = ( ~disablePastDates=true, ~disableFutureDates=false, ) => { - // ~cellHighlighter: option<(~date: Js.Date.t) => highlighter>=None, + // ~cellHighlighter: option<(~date: Date.t) => highlighter>=None, let _ = highLightList let months = [Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec] let heading = ["S", "M", "T", "W", "T", "F", "S"] diff --git a/src/components/InfraCalendarList.res b/src/components/InfraCalendarList.res index 68e443e96..434e1bb56 100644 --- a/src/components/InfraCalendarList.res +++ b/src/components/InfraCalendarList.res @@ -4,7 +4,7 @@ external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFina let startYear = ref(2016) let years = [] -while Js.Date.make()->Js.Date.getFullYear->Float.toInt >= startYear.contents { +while Date.make()->Js.Date.getFullYear->Float.toInt >= startYear.contents { years->Array.push(startYear.contents)->ignore startYear := startYear.contents + 1 } diff --git a/src/components/NewCalendar.res b/src/components/NewCalendar.res index caa97151f..da0a46da9 100644 --- a/src/components/NewCalendar.res +++ b/src/components/NewCalendar.res @@ -64,7 +64,7 @@ module TableRow = { "00", "00", )->Date.fromString - let dateToday = Js.Date.make() + let dateToday = Date.make() let todayInitial = Js.Date.setHoursMSMs( dateToday, ~hours=0.0, @@ -74,21 +74,21 @@ module TableRow = { (), ) let isInCustomDisable = if customDisabledFutureDays > 0.0 { - date->Js.Date.getTime -. todayInitial <= + date->Date.getTime -. todayInitial <= customDisabledFutureDays *. 24.0 *. 3600.0 *. 1000.0 } else { false } let isFutureDate = if disablePastDates { - todayInitial -. date->Js.Date.getTime <= 0.0 + todayInitial -. date->Date.getTime <= 0.0 } else { - todayInitial -. date->Js.Date.getTime < 0.0 + todayInitial -. date->Date.getTime < 0.0 } let isInLimit = switch dateRangeLimit { | Some(limit) => if startDate !== "" { - date->Js.Date.getTime -. startDate->Date.fromString->Js.Date.getTime < + date->Date.getTime -. startDate->Date.fromString->Date.getTime < ((limit->Js.Int.toFloat -. 1.) *. 24. *. 60. *. 60. -. 60.) *. 1000. } else { true @@ -109,7 +109,7 @@ module TableRow = { | true => switch onDateClick { | Some(fn) => - fn((Js.Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) + fn((Date.toISOString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD")) | None => () } @@ -117,7 +117,7 @@ module TableRow = { } } let hSelf = highlight( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), + (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD"), ) let dayClass = if ( @@ -141,13 +141,13 @@ module TableRow = { ) datevalue } - let today = (Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString).format(. + let today = (Date.make()->Date.toString->DayJs.getDayJsForString).format(. "YYYY-MM-DD", ) let renderingDate = ( getDate([Float.toString(year), Float.toString(month +. 1.0), obj]) - ->Js.Date.toString + ->Date.toString ->DayJs.getDayJsForString ).format(. "YYYY-MM-DD") let isTodayHighlight = @@ -282,9 +282,9 @@ module TableRow = { ) } let handleHover = () => { - let date = (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD") + let date = (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-DD") let parsedDate = getDate(String.split(date, "-")) - setHoverdDate(_ => parsedDate->Js.Date.toString) + setHoverdDate(_ => parsedDate->Date.toString) switch setShowMsg { | Some(setMsg) => if ( @@ -330,7 +330,7 @@ module TableRow = { obj == "" ? None : Some( - (Js.Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-D"), + (Date.toString(date)->DayJs.getDayJsForString).format(. "YYYY-MM-D"), ), )} {isTodayHighlight diff --git a/src/components/NewCalendarList.res b/src/components/NewCalendarList.res index cd05d9b56..a65e54d15 100644 --- a/src/components/NewCalendarList.res +++ b/src/components/NewCalendarList.res @@ -36,7 +36,7 @@ let make = ( let startYear = switch year { | Some(y) => Int.toFloat(y) - | None => Js.Date.getFullYear(Js.Date.make()) + | None => Js.Date.getFullYear(Date.make()) } React.useEffect2(() => { let fromDateJs = fromDate->DayJs.getDayJsForString @@ -129,7 +129,7 @@ let make = ( let startMonth = switch month { | Some(m) => Int.toFloat(Float.toInt(getMonthInFloat(m))) | None => { - let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Js.Date.make()))) + let tMonth = Int.toFloat(Float.toInt(Js.Date.getMonth(Date.make()))) disableFutureDates && count > 1 ? tMonth -. 1.0 : tMonth } } diff --git a/src/entities/analytics/AnalyticsUtils.res b/src/entities/analytics/AnalyticsUtils.res index cddd8ade0..6f67f96f8 100644 --- a/src/entities/analytics/AnalyticsUtils.res +++ b/src/entities/analytics/AnalyticsUtils.res @@ -147,7 +147,7 @@ let (startTimeFilterKey, endTimeFilterKey, optFilterKey) = ("startTime", "endTim let getDateCreatedObject = () => { let currentDate = Js.Date.now() let filterCreatedDict = Dict.make() - let currentTimestamp = currentDate->Js.Date.fromFloat->Js.Date.toISOString + let currentTimestamp = currentDate->Js.Date.fromFloat->Date.toISOString let dateFormat = "YYYY-MM-DDTHH:mm:[00][Z]" Dict.set( filterCreatedDict, @@ -164,7 +164,7 @@ let getDateCreatedObject = () => { JSON.Encode.string( prevTime ->Js.Date.fromFloat - ->Js.Date.toISOString + ->Date.toISOString ->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:[00][Z]"), ) } @@ -285,11 +285,11 @@ let filterBody = (filterBodyEntity: filterBodyEntity) => { (filterBodyEntity.startTime->DayJs.getDayJsForString).subtract(. 1, "day", - ).toDate(.)->Js.Date.toISOString, + ).toDate(.)->Date.toISOString, (filterBodyEntity.endTime->DayJs.getDayJsForString).add(. 1, "day", - ).toDate(.)->Js.Date.toISOString, + ).toDate(.)->Date.toISOString, ) } catch { | _ => (filterBodyEntity.startTime, filterBodyEntity.endTime) @@ -306,7 +306,7 @@ let filterBody = (filterBodyEntity: filterBodyEntity) => { let deltaDate = (~fromTime: string, ~_toTime: string, ~typeTime: string) => { let fromTime = fromTime - let nowtime = Js.Date.make()->Js.Date.toString->DayJs.getDayJsForString + let nowtime = Date.make()->Date.toString->DayJs.getDayJsForString let dateTimeFormat = "YYYY-MM-DDTHH:mm:ss[Z]" if typeTime == "last7" { let last7FromTime = (fromTime->DayJs.getDayJsForString).subtract(. 7, "day") @@ -347,12 +347,12 @@ let deltaDate = (~fromTime: string, ~_toTime: string, ~typeTime: string) => { [timeArray] } else if typeTime == "currentmonth" { - let currentMonth = Js.Date.fromFloat(Js.Date.setDate(Js.Date.make(), 1.0)) + let currentMonth = Js.Date.fromFloat(Js.Date.setDate(Date.make(), 1.0)) let currentMonthFromTime = Js.Date.fromFloat( Js.Date.setHoursMS(currentMonth, ~hours=0.0, ~minutes=0.0, ~seconds=0.0, ()), ) - ->Js.Date.toString + ->Date.toString ->DayJs.getDayJsForString let currentMonthToTime = nowtime let timeArray = Dict.fromArray([ @@ -362,8 +362,8 @@ let deltaDate = (~fromTime: string, ~_toTime: string, ~typeTime: string) => { [timeArray] } else if typeTime == "currentweek" { - let currentWeekFromTime = Js.Date.make()->DateTimeUtils.getStartOfWeek(Monday) - let currentWeekToTime = Js.Date.make()->DayJs.getDayJsForJsDate + let currentWeekFromTime = Date.make()->DateTimeUtils.getStartOfWeek(Monday) + let currentWeekToTime = Date.make()->DayJs.getDayJsForJsDate let timeArray = Dict.fromArray([ ("fromTime", currentWeekFromTime.format(. dateTimeFormat)), diff --git a/src/hooks/DateRefreshHooks.res b/src/hooks/DateRefreshHooks.res index 2ffe078b2..0c0b49f02 100644 --- a/src/hooks/DateRefreshHooks.res +++ b/src/hooks/DateRefreshHooks.res @@ -4,7 +4,7 @@ let useConstructQueryOnBasisOfOpt = () => { let customTimezoneToISOString = TimeZoneHook.useCustomTimeZoneToIsoString() let isoStringToCustomTimeZone = TimeZoneHook.useIsoStringToCustomTimeZone() let isoStringToCustomTimezoneInFloat = TimeZoneHook.useIsoStringToCustomTimeZoneInFloat() - let todayDayJsObj = Js.Date.make()->Js.Date.toString->getDayJsForString + let todayDayJsObj = Date.make()->Date.toString->getDayJsForString let todayDate = todayDayJsObj.format(. "YYYY-MM-DD") let todayTime = todayDayJsObj.format(. "HH:mm:ss") diff --git a/src/hooks/TimeZoneHook.res b/src/hooks/TimeZoneHook.res index 226c06ae6..9cb51e3ba 100644 --- a/src/hooks/TimeZoneHook.res +++ b/src/hooks/TimeZoneHook.res @@ -51,7 +51,7 @@ let dateTimeStringToDateTimeFloat = (dateTime: dateTimeString) => { } let formattedDateTimeFloat = (dateTime: dateTimeFloat, format: string) => { - (dateTime->dateTimeObjectToDate->Js.Date.toString->DayJs.getDayJsForString).format(. format) + (dateTime->dateTimeObjectToDate->Date.toString->DayJs.getDayJsForString).format(. format) } let formattedDateTimeString = (dateTime: dateTimeString, format: string) => { @@ -110,7 +110,7 @@ let en_USStringToDateTimeObject = dateTimeIsoString => { } type timeZoneObject = {timeZone: string} -@send external toLocaleString: (Js.Date.t, string, timeZoneObject) => string = "toLocaleString" +@send external toLocaleString: (Date.t, string, timeZoneObject) => string = "toLocaleString" let convertTimeZone = (date, timezoneString) => { let localTimeString = Date.fromString(date) localTimeString @@ -148,7 +148,7 @@ let useCustomTimeZoneToIsoString = () => { secondsString ++ timezone let newFormedDate = Date.fromString(fullTimeManagedString) - let isoFormattedDate = Js.Date.toISOString(newFormedDate) + let isoFormattedDate = Date.toISOString(newFormedDate) isoFormattedDate }, [zone], diff --git a/src/libraries/DayJs.res b/src/libraries/DayJs.res index 781cdd994..a56c3ddd6 100644 --- a/src/libraries/DayJs.res +++ b/src/libraries/DayJs.res @@ -12,7 +12,7 @@ external customParseFormat: relativeTime = "default" type rec dayJs = { isValid: (. unit) => bool, toString: (. unit) => string, - toDate: (. unit) => Js.Date.t, + toDate: (. unit) => Date.t, add: (. int, string) => dayJs, isSame: (. string, string) => bool, subtract: (. int, string) => dayJs, @@ -41,5 +41,5 @@ external getDayJsForString: string => dayJs = "default" external getDayJsFromCustromFormat: (string, string, bool) => dayJs = "default" let getDayJsForJsDate = date => { - date->Js.Date.toString->getDayJsForString + date->Date.toString->getDayJsForString } diff --git a/src/libraries/RRule.res b/src/libraries/RRule.res index 2bdbfebe0..5ae5f45ae 100644 --- a/src/libraries/RRule.res +++ b/src/libraries/RRule.res @@ -21,8 +21,8 @@ type durationUnit = type scheduleRuleRecipe = { recurrence: option, - dateWhitelist: option>, - dateBlacklist: option>, + dateWhitelist: option>, + dateBlacklist: option>, durationUnit: durationUnit, durationAmount: int, } @@ -36,7 +36,7 @@ let durationSeconds: (durationUnit, int) => int = (dUnit, dAmount) => { } } -let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = ( +let isScheduled: (scheduleRuleRecipe, Date.t, Date.t, Date.t) => bool = ( recipe, startTime, endTime, @@ -159,17 +159,17 @@ let isScheduled: (scheduleRuleRecipe, Js.Date.t, Js.Date.t, Js.Date.t) => bool = | Yearly => mod(getYear(currentTime) - getYear(startTime), recur.interval) == 0 | Monthly => mod( - (currentTime->DayJs.getDayJsForJsDate).diff(. Js.Date.toString(startTime), "month"), + (currentTime->DayJs.getDayJsForJsDate).diff(. Date.toString(startTime), "month"), recur.interval, ) == 0 | Weekly => mod( - (currentTime->DayJs.getDayJsForJsDate).diff(. Js.Date.toString(startTime), "week"), + (currentTime->DayJs.getDayJsForJsDate).diff(. Date.toString(startTime), "week"), recur.interval, ) == 0 | Daily => mod( - (currentTime->DayJs.getDayJsForJsDate).diff(. Js.Date.toString(startTime), "day"), + (currentTime->DayJs.getDayJsForJsDate).diff(. Date.toString(startTime), "day"), recur.interval, ) == 0 } diff --git a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res index 48fdf6000..b6a7edd49 100644 --- a/src/screens/HyperSwitch/Analytics/DownloadReportModal.res +++ b/src/screens/HyperSwitch/Analytics/DownloadReportModal.res @@ -56,9 +56,9 @@ let make = (~reportModal, ~setReportModal, ~entityName) => { } let getPreviousDate = () => { - let currentDate = Js.Date.getTime(Js.Date.make()) + let currentDate = Date.getTime(Date.make()) let previousDateMilliseconds = currentDate -. 86400000.0 - let previousDate = Js.Date.fromFloat(previousDateMilliseconds)->Js.Date.toISOString + let previousDate = Js.Date.fromFloat(previousDateMilliseconds)->Date.toISOString previousDate->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:ss[Z]") } @@ -66,7 +66,7 @@ let make = (~reportModal, ~setReportModal, ~entityName) => { filters: { dateCreated: { gte: getPreviousDate()->JSON.Encode.string, - lte: Js.Date.now()->Js.Date.fromFloat->Js.Date.toISOString->JSON.Encode.string, + lte: Js.Date.now()->Js.Date.fromFloat->Date.toISOString->JSON.Encode.string, }, }, }->Identity.genericTypeToJson diff --git a/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res b/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res index fbe1bc025..772bb11a4 100644 --- a/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res +++ b/src/screens/HyperSwitch/HSiwtchTimeZoneUtils.res @@ -1,5 +1,5 @@ let getUserTimeZoneString = () => { - Js.Date.make()->Js.Date.toTimeString->String.split(" ")->Array.get(1)->Option.getOr("") + Date.make()->Js.Date.toTimeString->String.split(" ")->Array.get(1)->Option.getOr("") } let getUserTimeZone = () => { diff --git a/src/screens/HyperSwitch/HSwitchRemoteFilter.res b/src/screens/HyperSwitch/HSwitchRemoteFilter.res index 2c6dd3077..6d55ed38d 100644 --- a/src/screens/HyperSwitch/HSwitchRemoteFilter.res +++ b/src/screens/HyperSwitch/HSwitchRemoteFilter.res @@ -10,11 +10,11 @@ let getDateValue = (key, ~getModuleFilters) => { } let formateDateString = date => { - date->Js.Date.toISOString->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:[00][Z]") + date->Date.toISOString->TimeZoneHook.formattedISOString("YYYY-MM-DDTHH:mm:[00][Z]") } let getDateFilteredObject = () => { - let currentDate = Js.Date.make() + let currentDate = Date.make() let end_time = currentDate->formateDateString diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index fd4f2e49a..ce83a4c1d 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -405,11 +405,11 @@ let make = (~paymentId, ~createdAt) => { try { let url = getURL(~entityName=SDK_EVENT_LOGS, ~methodType=Post, ~id=Some(paymentId), ()) - let startTime = createdAt->Date.fromString->Js.Date.getTime -. 1000. *. 60. *. 5. - let startTime = startTime->Js.Date.fromFloat->Js.Date.toISOString + let startTime = createdAt->Date.fromString->Date.getTime -. 1000. *. 60. *. 5. + let startTime = startTime->Js.Date.fromFloat->Date.toISOString - let endTime = createdAt->Date.fromString->Js.Date.getTime +. 1000. *. 60. *. 60. *. 3. - let endTime = endTime->Js.Date.fromFloat->Js.Date.toISOString + let endTime = createdAt->Date.fromString->Date.getTime +. 1000. *. 60. *. 60. *. 3. + let endTime = endTime->Js.Date.fromFloat->Date.toISOString let body = [ ("paymentId", paymentId->JSON.Encode.string), diff --git a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res index 7f2bfbabf..57b8f483d 100644 --- a/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res +++ b/src/screens/HyperSwitch/SelfServe/HSwitchProdOnboarding/HSwitchAgreementScreen.res @@ -31,7 +31,7 @@ let make = () => { let currentDate = Js.Date.now() ->Js.Date.fromFloat - ->Js.Date.toISOString + ->Date.toISOString ->TimeZoneHook.formattedISOString("YYYY-MM-DD HH:mm:ss") //? - For localtesting this condn added diff --git a/src/utils/AnalyticsNewUtils.res b/src/utils/AnalyticsNewUtils.res index 8bd03f3cb..c3546a831 100644 --- a/src/utils/AnalyticsNewUtils.res +++ b/src/utils/AnalyticsNewUtils.res @@ -19,7 +19,7 @@ let calculateHistoricTime = ( let endDateTime = endTime->DateTimeUtils.parseAsFloat->Js.Date.fromFloat->toUtc let endDateTimeJs = endDateTime->DayJs.getDayJsForJsDate - let timediff = endDateTimeJs.diff(. Js.Date.toString(startDateTime), "hours") + let timediff = endDateTimeJs.diff(. Date.toString(startDateTime), "hours") if timediff < 24 { ( diff --git a/src/utils/DateRangeUtils.res b/src/utils/DateRangeUtils.res index 6f994b704..56cfbabe4 100644 --- a/src/utils/DateRangeUtils.res +++ b/src/utils/DateRangeUtils.res @@ -90,33 +90,33 @@ let getPredefinedStartAndEndDate = ( let todayInitial = date let today = todayInitial - ->Js.Date.toISOString + ->Date.toISOString ->isoStringToCustomTimezoneInFloat ->TimeZoneHook.dateTimeObjectToDate let msInADay = 24.0 *. 60.0 *. 60.0 *. 1000.0 let durationSecs: float = (count -. 1.0) *. msInADay - let dateBeforeDuration = today->Js.Date.getTime->Js.Date.fromFloat + let dateBeforeDuration = today->Date.getTime->Js.Date.fromFloat let msInterval = disableFutureDates - ? dateBeforeDuration->Js.Date.getTime -. durationSecs - : dateBeforeDuration->Js.Date.getTime +. durationSecs + ? dateBeforeDuration->Date.getTime -. durationSecs + : dateBeforeDuration->Date.getTime +. durationSecs let dateAfterDuration = msInterval->Js.Date.fromFloat let (finalStartDate, finalEndDate) = disableFutureDates ? (dateAfterDuration, dateBeforeDuration) : (dateBeforeDuration, dateAfterDuration) - let startDate = getDateString(finalStartDate->Js.Date.toString, isoStringToCustomTimeZone) - let endDate = getDateString(finalEndDate->Js.Date.toString, isoStringToCustomTimeZone) + let startDate = getDateString(finalStartDate->Date.toString, isoStringToCustomTimeZone) + let endDate = getDateString(finalEndDate->Date.toString, isoStringToCustomTimeZone) let endTime = { let eTime = switch value { - | Hour(_) => getTimeString(finalEndDate->Js.Date.toString, isoStringToCustomTimeZone) + | Hour(_) => getTimeString(finalEndDate->Date.toString, isoStringToCustomTimeZone) | _ => "23:59:59" } disableFutureDates && endDate == todayDate ? todayTime : eTime } let startTime = { let sTime = switch value { - | Hour(_) => getTimeString(finalStartDate->Js.Date.toString, isoStringToCustomTimeZone) + | Hour(_) => getTimeString(finalStartDate->Date.toString, isoStringToCustomTimeZone) | _ => "00:00:00" } !disableFutureDates && (value !== Today || disablePastDates) && startDate == todayDate diff --git a/src/utils/DateTimeUtils.res b/src/utils/DateTimeUtils.res index 6e0739de8..d2b70fdf8 100644 --- a/src/utils/DateTimeUtils.res +++ b/src/utils/DateTimeUtils.res @@ -13,7 +13,7 @@ let dayMapper = (days: days) => { | Saturday => "Saturday" } } -let cloneDate = date => date->Js.Date.getTime->Js.Date.fromFloat +let cloneDate = date => date->Date.getTime->Js.Date.fromFloat let makeStartOfDayDate = date => { let date = Js.Date.setHoursMSMs( cloneDate(date), @@ -26,7 +26,7 @@ let makeStartOfDayDate = date => { Js.Date.fromFloat(date) } -let getStartOfWeek = (dayJs: Js.Date.t, startOfday: days) => { +let getStartOfWeek = (dayJs: Date.t, startOfday: days) => { let day = Js.Date.getDay(dayJs) let startWeekDay = daysArr->Array.indexOf(startOfday)->Int.toFloat let diff = (day < startWeekDay ? 7. : 0.) +. day -. startWeekDay @@ -43,9 +43,9 @@ let utcToIST = timeStr => { let istTime = Js.Date.setHoursM(timeStr, ~hours=updatedHour, ~minutes=updatedMin, ()) if isEU { - timeStr->Js.Date.toISOString + timeStr->Date.toISOString } else { - Js.Date.fromFloat(istTime)->Js.Date.toISOString + Js.Date.fromFloat(istTime)->Date.toISOString } } @@ -75,14 +75,14 @@ let parseAsFloat = (dateStr: string) => { )->Js.Date.valueOf } -let toUtc = (datetime: Js.Date.t) => { +let toUtc = (datetime: Date.t) => { let offset = Js.Date.getTimezoneOffset(Js.Date.now()->Js.Date.fromFloat)->Int.fromFloat (datetime->DayJs.getDayJsForJsDate).add(. offset, "minute").toDate(.) } let getStartEndDiff = (startDate, endDate) => { let diffTime = Math.abs( - endDate->Date.fromString->Js.Date.getTime -. startDate->Date.fromString->Js.Date.getTime, + endDate->Date.fromString->Date.getTime -. startDate->Date.fromString->Date.getTime, ) diffTime } @@ -105,7 +105,7 @@ let isStartBeforeEndDate = (start, end) => { } let getFormattedDate = (date, format) => { - date->Date.fromString->Js.Date.toISOString->TimeZoneHook.formattedISOString(format) + date->Date.fromString->Date.toISOString->TimeZoneHook.formattedISOString(format) } type month = Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec diff --git a/src/utils/TimeZoneConversion.res b/src/utils/TimeZoneConversion.res index 553ae5dea..c16f75516 100644 --- a/src/utils/TimeZoneConversion.res +++ b/src/utils/TimeZoneConversion.res @@ -1,5 +1,5 @@ type timeZoneObject = {timeZone: string} -@send external toLocaleString: (Js.Date.t, string, timeZoneObject) => string = "toLocaleString" +@send external toLocaleString: (Date.t, string, timeZoneObject) => string = "toLocaleString" type dateTime = { year: float,