Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 20 additions & 7 deletions app/containers/markdown/Markdown.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,25 @@ export const Lists = () => (

export const Timestamp = () => (
<View style={styles.container}>
<Markdown msg='t: <t:1735732800:t>' />
<Markdown msg='T: <t:1735732800:T>' />
<Markdown msg='d: <t:1735732800:d>' />
<Markdown msg='D: <t:1735732800:D>' />
<Markdown msg='f: <t:1735732800:f>' />
<Markdown msg='F: <t:1735732800:F>' />
<Markdown msg='R: <t:1735732800:R>' />
<Markdown msg='t (unix): <t:1735732800:t>' />
<Markdown msg='t (iso): <t:2026-01-23T12:16:24.314+00:00:t>' />

<Markdown msg='T (unix): <t:1735732800:T>' />
<Markdown msg='T (iso): <t:2026-01-23T12:16:24.314+00:00:T>' />

<Markdown msg='d (unix): <t:1735732800:d>' />
<Markdown msg='d (iso): <t:2026-01-23T12:16:24.314+00:00:d>' />

<Markdown msg='D (unix): <t:1735732800:D>' />
<Markdown msg='D (iso): <t:2026-01-23T12:16:24.314+00:00:D>' />

<Markdown msg='f (unix): <t:1735732800:f>' />
<Markdown msg='f (iso): <t:2026-01-23T12:16:24.314+00:00:f>' />

<Markdown msg='F (unix): <t:1735732800:F>' />
<Markdown msg='F (iso): <t:2026-01-23T12:16:24.314+00:00:F>' />

<Markdown msg='R (unix): <t:1735732800:R>' />
<Markdown msg='R (iso): <t:2026-01-23T12:16:24.314+00:00:R>' />
</View>
);
10 changes: 9 additions & 1 deletion app/containers/markdown/components/Timestamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ interface ITimestampProps {
const Timestamp = ({ value }: ITimestampProps): React.ReactElement => {
const { colors } = useTheme();

const timestampMs = React.useMemo(() => parseInt(value.timestamp, 10) * 1000, [value.timestamp]);
const timestampMs = React.useMemo(() => {
const isUnix = /^\d+$/.test(value.timestamp);

if (isUnix) {
return Number(value.timestamp) * 1000;
}

return dayjs(value.timestamp).valueOf();
}, [value.timestamp]);

const formatDate = React.useMemo(() => {
if (value.format === 't') {
Expand Down
Loading