-
Notifications
You must be signed in to change notification settings - Fork 13.9k
chore: migrate client-side code from moment to date-fns #40076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
aa16139
chore: migrate client-side code from moment to date-fns
ggazzo b5be9ee
fix: update test expectations for date-fns format differences
ggazzo 617a337
fix: revert unrelated UserInfo.tsx changes from rebase
ggazzo 473846e
fix: update UserInfo snapshot for date-fns ordinal format
ggazzo 9421ef9
fix: restore 'moment' in BIP-39 wordlist and handle fractional timezo…
ggazzo cb2bbc5
fix: address code review findings (P2)
ggazzo 3ac9e71
fix: prettier formatting in ActiveUsersSection
ggazzo d117091
fix: prettier formatting in ActiveUsersSection
ggazzo 443e7c0
fix: revert cron to ~1.8.2 to avoid breaking server-side business hours
ggazzo 73abbc0
fix: restore cron type declaration for sendAt
ggazzo c9cc50f
fix: revert RetentionPolicyWarning test for cron@1.8.x behavior
ggazzo 9cb67c4
refactor: remove moment-timezone from @rocket.chat/tools
ggazzo d83fea1
fix: add new to Intl.DateTimeFormat call to satisfy new-cap lint rule
ggazzo ab53666
Merge branch 'develop' into chore/remove-moment-client
ggazzo 1f18f19
Merge branch 'develop' into chore/remove-moment-client
ggazzo 3f86b25
Apply suggestion from @ggazzo
ggazzo 4149a8d
Update apps/meteor/client/views/admin/engagementDashboard/users/Conte…
ggazzo 4df4b0f
fix: use real IANA timezones instead of Etc/GMT and map moment Y token
ggazzo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| declare module 'cron' { | ||
| export declare function sendAt(precision: string): Moment; | ||
| export declare function sendAt(precision: string): { valueOf(): number }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,9 @@ | ||
| import { useSetting } from '@rocket.chat/ui-contexts'; | ||
| import moment from 'moment'; | ||
| import { useCallback } from 'react'; | ||
|
|
||
| import { formatDate } from '../lib/utils/dateFormat'; | ||
|
|
||
| export const useFormatDate = () => { | ||
| const format = useSetting('Message_DateFormat'); | ||
| return useCallback((time: string | Date | number) => moment(time).format(String(format)), [format]); | ||
| return useCallback((time: string | Date | number) => formatDate(time, String(format)), [format]); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,5 @@ | ||
| import moment from 'moment'; | ||
| import { useMemo } from 'react'; | ||
|
|
||
| export const useFormattedRelativeTime = (timeMs: number): string => | ||
| useMemo(() => { | ||
| moment.relativeTimeThreshold('s', 60); | ||
| moment.relativeTimeThreshold('ss', 0); | ||
| moment.relativeTimeThreshold('m', 60); | ||
| moment.relativeTimeThreshold('h', 24); | ||
| moment.relativeTimeThreshold('d', 31); | ||
| moment.relativeTimeThreshold('M', 12); | ||
| import { formatDurationMs } from '../lib/utils/dateFormat'; | ||
|
|
||
| return moment.duration(timeMs).humanize(); | ||
| }, [timeMs]); | ||
| export const useFormattedRelativeTime = (timeMs: number): string => useMemo(() => formatDurationMs(timeMs), [timeMs]); | ||
|
dougfabris marked this conversation as resolved.
dougfabris marked this conversation as resolved.
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.