@@ -35,7 +35,7 @@ export const DateTime = ({
3535 const tooltipContent = (
3636 < div className = "flex flex-col gap-1" >
3737 { ! timeZone || timeZone === "UTC" ? (
38- < div className = "flex flex-col gap-3" >
38+ < div className = "flex flex-col gap-3 pb-1 " >
3939 < DateTimeTooltipContent
4040 title = "UTC"
4141 dateTime = { formatDateTime ( realDate , "UTC" , locales , true , true ) }
@@ -50,7 +50,7 @@ export const DateTime = ({
5050 />
5151 </ div >
5252 ) : (
53- < div className = "flex flex-col gap-3" >
53+ < div className = "flex flex-col gap-3 pb-1 " >
5454 < DateTimeTooltipContent
5555 title = { timeZone }
5656 dateTime = { formatDateTime ( realDate , timeZone , locales , true , true ) }
@@ -285,13 +285,22 @@ function DateTimeTooltipContent({
285285 isoDateTime,
286286 icon,
287287} : DateTimeTooltipContentProps ) {
288+ const getUtcOffset = ( ) => {
289+ if ( title !== "Local" ) return "" ;
290+ const offset = - new Date ( ) . getTimezoneOffset ( ) ;
291+ const sign = offset >= 0 ? "+" : "-" ;
292+ const hours = Math . abs ( Math . floor ( offset / 60 ) ) ;
293+ return `(UTC ${ sign } ${ hours } )` ;
294+ } ;
295+
288296 return (
289297 < div className = "flex flex-col gap-1" >
290298 < div className = "flex items-center gap-1 text-sm" >
291299 { icon }
292300 < span className = "font-medium" > { title } </ span >
301+ < span className = "font-normal text-text-dimmed" > { getUtcOffset ( ) } </ span >
293302 </ div >
294- < div className = "flex items-center gap-2" >
303+ < div className = "flex items-center justify-between gap-2" >
295304 < Paragraph variant = "extra-small" className = "text-text-dimmed" >
296305 { dateTime }
297306 </ Paragraph >
0 commit comments