Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523272
D5984.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
8 KB
Referenced Files
None
Subscribers
None
D5984.diff
View Options
diff --git a/lib/utils/date-utils.js b/lib/utils/date-utils.js
--- a/lib/utils/date-utils.js
+++ b/lib/utils/date-utils.js
@@ -84,10 +84,10 @@
const millisecondsInYear = millisecondsInDay * 365;
// Takes a millisecond timestamp and displays the time in the local timezone
-function shortAbsoluteDate(timestamp: number, timeZone?: ?string): string {
+function shortAbsoluteDate(timestamp: number): string {
const now = Date.now();
const msSince = now - timestamp;
- const date = changeTimeZone(new Date(timestamp), timeZone);
+ const date = new Date(timestamp);
if (msSince < millisecondsInDay) {
return dateFormat(date, 'h:MM TT');
} else if (msSince < millisecondsInWeek) {
@@ -100,10 +100,10 @@
}
// Same as above, but longer
-function longAbsoluteDate(timestamp: number, timeZone?: ?string): string {
+function longAbsoluteDate(timestamp: number): string {
const now = Date.now();
const msSince = now - timestamp;
- const date = changeTimeZone(new Date(timestamp), timeZone);
+ const date = new Date(timestamp);
if (msSince < millisecondsInDay) {
return dateFormat(date, 'h:MM TT');
} else if (msSince < millisecondsInWeek) {
diff --git a/web/calendar/day.react.js b/web/calendar/day.react.js
--- a/web/calendar/day.react.js
+++ b/web/calendar/day.react.js
@@ -19,11 +19,7 @@
import type { EntryInfo } from 'lib/types/entry-types';
import type { Dispatch } from 'lib/types/redux-types';
import type { ThreadInfo } from 'lib/types/thread-types';
-import {
- dateString,
- dateFromString,
- currentDateInTimeZone,
-} from 'lib/utils/date-utils';
+import { dateString, dateFromString } from 'lib/utils/date-utils';
import LogInFirstModal from '../modals/account/log-in-first-modal.react';
import HistoryModal from '../modals/history/history-modal.react';
@@ -46,7 +42,6 @@
+viewerID: ?string,
+loggedIn: boolean,
+nextLocalID: number,
- +timeZone: ?string,
+dispatch: Dispatch,
+pushModal: PushModal,
+popModal: () => void,
@@ -71,7 +66,7 @@
}
render() {
- const now = currentDateInTimeZone(this.props.timeZone);
+ const now = new Date();
const isToday = dateString(now) === this.props.dayString;
const tdClasses = classNames(css.day, { [css.currentDay]: isToday });
@@ -242,7 +237,6 @@
!!(state.currentUserInfo && !state.currentUserInfo.anonymous && true),
);
const nextLocalID = useSelector(state => state.nextLocalID);
- const timeZone = useSelector(state => state.timeZone);
const dispatch = useDispatch();
const { pushModal, popModal } = useModalContext();
@@ -253,7 +247,6 @@
viewerID={viewerID}
loggedIn={loggedIn}
nextLocalID={nextLocalID}
- timeZone={timeZone}
dispatch={dispatch}
pushModal={pushModal}
popModal={popModal}
diff --git a/web/chat/chat-message-list.react.js b/web/chat/chat-message-list.react.js
--- a/web/chat/chat-message-list.react.js
+++ b/web/chat/chat-message-list.react.js
@@ -46,7 +46,6 @@
+activeChatThreadID: ?string,
+messageListData: ?$ReadOnlyArray<ChatMessageItem>,
+startReached: boolean,
- +timeZone: ?string,
+supportsReverseFlex: boolean,
// Redux dispatch functions
+dispatchActionPromise: DispatchActionPromise,
@@ -176,7 +175,6 @@
<Message
item={item}
threadInfo={threadInfo}
- timeZone={this.props.timeZone}
key={ChatMessageList.keyExtractor(item)}
/>
);
@@ -289,8 +287,6 @@
);
}, [userAgent]);
- const timeZone = useSelector(state => state.timeZone);
-
const messageListData = useMessageListData({
threadInfo,
searching: false,
@@ -339,7 +335,6 @@
threadInfo={threadInfo}
messageListData={messageListData}
startReached={startReached}
- timeZone={timeZone}
supportsReverseFlex={supportsReverseFlex}
inputState={inputState}
dispatchActionPromise={dispatchActionPromise}
diff --git a/web/chat/chat-thread-list-item.react.js b/web/chat/chat-thread-list-item.react.js
--- a/web/chat/chat-thread-list-item.react.js
+++ b/web/chat/chat-thread-list-item.react.js
@@ -34,11 +34,7 @@
const ancestorThreads = useAncestorThreads(threadInfo);
- const timeZone = useSelector(state => state.timeZone);
- const lastActivity = shortAbsoluteDate(
- lastUpdatedTimeIncludingSidebars,
- timeZone,
- );
+ const lastActivity = shortAbsoluteDate(lastUpdatedTimeIncludingSidebars);
const active = useThreadIsActive(threadID);
const isCreateMode = useSelector(
diff --git a/web/chat/message.react.js b/web/chat/message.react.js
--- a/web/chat/message.react.js
+++ b/web/chat/message.react.js
@@ -16,16 +16,15 @@
type Props = {
+item: ChatMessageInfoItem,
+threadInfo: ThreadInfo,
- +timeZone: ?string,
};
function Message(props: Props): React.Node {
- const { item, timeZone } = props;
+ const { item } = props;
let conversationHeader = null;
if (item.startsConversation) {
conversationHeader = (
<div className={css.conversationHeader}>
- {longAbsoluteDate(item.messageInfo.time, timeZone)}
+ {longAbsoluteDate(item.messageInfo.time)}
</div>
);
}
diff --git a/web/modals/threads/sidebars/sidebar.react.js b/web/modals/threads/sidebars/sidebar.react.js
--- a/web/modals/threads/sidebars/sidebar.react.js
+++ b/web/modals/threads/sidebars/sidebar.react.js
@@ -9,7 +9,6 @@
import Button from '../../../components/button.react';
import { getDefaultTextMessageRules } from '../../../markdown/rules.react';
-import { useSelector } from '../../../redux/redux-utils';
import { useOnClickThread } from '../../../selectors/thread-selectors';
import css from './sidebars-modal.css';
@@ -23,7 +22,6 @@
const { threadInfo, lastUpdatedTime, mostRecentMessageInfo } = sidebar;
const { unread } = threadInfo.currentUser;
- const timeZone = useSelector(state => state.timeZone);
const { popModal } = useModalContext();
const navigateToThread = useOnClickThread(threadInfo);
@@ -41,10 +39,9 @@
[css.unread]: unread,
});
- const lastActivity = React.useMemo(
- () => shortAbsoluteDate(lastUpdatedTime, timeZone),
- [lastUpdatedTime, timeZone],
- );
+ const lastActivity = React.useMemo(() => shortAbsoluteDate(lastUpdatedTime), [
+ lastUpdatedTime,
+ ]);
const lastMessage = React.useMemo(() => {
if (!mostRecentMessageInfo) {
diff --git a/web/modals/threads/subchannels/subchannel.react.js b/web/modals/threads/subchannels/subchannel.react.js
--- a/web/modals/threads/subchannels/subchannel.react.js
+++ b/web/modals/threads/subchannels/subchannel.react.js
@@ -10,7 +10,6 @@
import Button from '../../../components/button.react';
import { getDefaultTextMessageRules } from '../../../markdown/rules.react';
-import { useSelector } from '../../../redux/redux-utils';
import { useOnClickThread } from '../../../selectors/thread-selectors';
import SWMansionIcon from '../../../SWMansionIcon.react';
import css from './subchannels-modal.css';
@@ -34,7 +33,6 @@
[css.unread]: unread,
});
- const timeZone = useSelector(state => state.timeZone);
const { popModal } = useModalContext();
const navigateToThread = useOnClickThread(threadInfo);
@@ -48,8 +46,8 @@
);
const lastActivity = React.useMemo(
- () => shortAbsoluteDate(lastUpdatedTimeIncludingSidebars, timeZone),
- [lastUpdatedTimeIncludingSidebars, timeZone],
+ () => shortAbsoluteDate(lastUpdatedTimeIncludingSidebars),
+ [lastUpdatedTimeIncludingSidebars],
);
const lastMessage = React.useMemo(() => {
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -64,7 +64,6 @@
enabledApps: EnabledApps,
reportStore: ReportStore,
nextLocalID: number,
- timeZone: ?string,
userAgent: ?string,
dataLoaded: boolean,
windowActive: boolean,
diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js
--- a/web/utils/tooltip-utils.js
+++ b/web/utils/tooltip-utils.js
@@ -24,7 +24,6 @@
import { useTooltipContext } from '../chat/tooltip-provider';
import CommIcon from '../CommIcon.react';
import { InputStateContext } from '../input/input-state';
-import { useSelector } from '../redux/redux-utils';
import {
useOnClickPendingSidebar,
useOnClickThread,
@@ -445,12 +444,10 @@
const containsInlineSidebar = !!item.threadCreatedFromMessage;
- const timeZone = useSelector(state => state.timeZone);
-
const messageTimestamp = React.useMemo(() => {
const time = item.messageInfo.time;
- return longAbsoluteDate(time, timeZone);
- }, [item.messageInfo.time, timeZone]);
+ return longAbsoluteDate(time);
+ }, [item.messageInfo.time]);
const tooltipSize = React.useMemo(() => {
if (typeof document === 'undefined') {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 8:51 AM (16 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2699306
Default Alt Text
D5984.diff (8 KB)
Attached To
Mode
D5984: [web] Remove timeZone from Redux state
Attached
Detach File
Event Timeline
Log In to Comment