File tree 1 file changed +4
-1
lines changed
client/my-sites/stats/hooks
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import moment from 'moment';
4
4
import { useSelector } from 'calypso/state' ;
5
5
import { getSiteOption } from 'calypso/state/sites/selectors' ;
6
6
import { getSelectedSiteId } from 'calypso/state/ui/selectors' ;
7
+ import { DATE_FORMAT } from '../constants' ;
7
8
8
9
export const getMomentSiteZone = createSelector (
9
10
( state : object , siteId : number | null ) => {
@@ -16,7 +17,9 @@ export const getMomentSiteZone = createSelector(
16
17
17
18
const gmtOffset = getSiteOption ( state , siteId , 'gmt_offset' ) as number ;
18
19
if ( Number . isFinite ( gmtOffset ) ) {
19
- return localizedMoment . utcOffset ( gmtOffset ) ;
20
+ // In all the components, `moment` is directly used, which defaults to the browser's local timezone.
21
+ // As a result, we need to convert the moment object to the site's timezone for easier comparison like `isSame`.
22
+ return moment ( localizedMoment . utcOffset ( gmtOffset ) . format ( DATE_FORMAT ) ) ;
20
23
}
21
24
22
25
// Falls back to the browser's local timezone if no GMT offset is found
You can’t perform that action at this time.
0 commit comments