-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(message-parser): add timestamps pattern (#31810)
Co-authored-by: Diego Sampaio <[email protected]>
- Loading branch information
1 parent
b876e4e
commit 5ad65ff
Showing
22 changed files
with
424 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
"@rocket.chat/message-parser": patch | ||
--- | ||
|
||
feat(message-parser): add timestamps pattern | ||
|
||
### Usage | ||
|
||
Pattern: <t:{timestamp}:?{format}> | ||
|
||
- {timestamp} is a Unix timestamp | ||
- {format} is an optional parameter that can be used to customize the date and time format. | ||
|
||
#### Formats | ||
|
||
| Format | Description | Example | | ||
| ------ | ------------------------- | --------------------------------------- | | ||
| `t` | Short time | 12:00 AM | | ||
| `T` | Long time | 12:00:00 AM | | ||
| `d` | Short date | 12/31/2020 | | ||
| `D` | Long date | Thursday, December 31, 2020 | | ||
| `f` | Full date and time | Thursday, December 31, 2020 12:00 AM | | ||
| `F` | Full date and time (long) | Thursday, December 31, 2020 12:00:00 AM | | ||
| `R` | Relative time | 1 year ago | |
This file contains 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 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 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 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 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 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 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 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 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
21 changes: 21 additions & 0 deletions
21
packages/gazzodown/src/elements/Timestamp/ErrorBoundary.tsx
This file contains 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Component } from 'react'; | ||
|
||
export class ErrorBoundary extends Component<{ fallback: React.ReactNode }, { hasError: boolean }> { | ||
constructor(props: { fallback: React.ReactNode }) { | ||
super(props); | ||
this.state = { hasError: false }; | ||
} | ||
|
||
static getDerivedStateFromError() { | ||
return { hasError: true }; | ||
} | ||
|
||
render() { | ||
if (this.state.hasError) { | ||
// You can render any custom fallback UI | ||
return this.props.fallback; | ||
} | ||
|
||
return this.props.children; | ||
} | ||
} |
Oops, something went wrong.