Skip to content

Commit

Permalink
feat: display timezone adjusted custom time range in time picker plac…
Browse files Browse the repository at this point in the history
…eholder
  • Loading branch information
ahmadshaheer committed Nov 24, 2024
1 parent d35ee88 commit 429c87a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import getTimeString from 'lib/getTimeString';
import history from 'lib/history';
import { isObject } from 'lodash-es';
import { Check, Copy, Info, Send, Undo } from 'lucide-react';
import { useTimezone } from 'providers/Timezone';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useQueryClient } from 'react-query';
import { connect, useSelector } from 'react-redux';
Expand Down Expand Up @@ -613,6 +614,8 @@ function DateTimeSelection({
);
};

const { timezone } = useTimezone();

return (
<div className="date-time-selector">
{showResetButton && selectedTime !== defaultRelativeTime && (
Expand Down Expand Up @@ -664,8 +667,8 @@ function DateTimeSelection({
setIsValidteRelativeTime(isValid);
}}
selectedValue={getInputLabel(
dayjs(minTime / 1000000),
dayjs(maxTime / 1000000),
dayjs(minTime / 1000000).tz(timezone.value),
dayjs(maxTime / 1000000).tz(timezone.value),
selectedTime,
)}
data-testid="dropDown"
Expand Down

0 comments on commit 429c87a

Please sign in to comment.