Skip to content

Commit

Permalink
Merge pull request #2951 from tloncorp/po/land-944-invalid-time-value…
Browse files Browse the repository at this point in the history
…-issue

notebook: don't attempt to get a time from an empty string, use sent value where possible
  • Loading branch information
patosullivan authored Oct 13, 2023
2 parents 3bbb95c + b1fac73 commit 9027053
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
3 changes: 1 addition & 2 deletions ui/src/diary/DiaryComment.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable react/no-unused-prop-types */
import React from 'react';
import { BigInteger } from 'big-integer';
import { daToUnix } from '@urbit/api';
import { format } from 'date-fns';
import Author from '@/chat/ChatMessage/Author';
// eslint-disable-next-line import/no-cycle
Expand Down Expand Up @@ -32,7 +31,7 @@ const DiaryComment = React.memo<
) => {
const { cork, memo } = quip;
const flag = useChannelFlag();
const unix = new Date(daToUnix(time));
const unix = new Date(quip.memo.sent);
const normalizedContent: ChatStory = {
...memo.content,
block: memo.content.block.filter(
Expand Down
19 changes: 11 additions & 8 deletions ui/src/diary/DiaryNote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,18 @@ export default function DiaryNote({ title }: ViewProps) {
const { quips } = note.seal;
const quipArray = Array.from(quips).reverse(); // natural reading order
const canWrite = canWriteChannel(perms, vessel, group?.bloc);
const groupedQuips = setNewDays(
groupQuips(noteId, quipArray, brief).sort(([a], [b]) => {
if (sort === 'asc') {
return a.localeCompare(b);
}
const groupedQuips =
noteId !== ''
? setNewDays(
groupQuips(noteId, quipArray, brief).sort(([a], [b]) => {
if (sort === 'asc') {
return a.localeCompare(b);
}

return b.localeCompare(a);
})
);
return b.localeCompare(a);
})
)
: [];

return (
<Layout
Expand Down

0 comments on commit 9027053

Please sign in to comment.