We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4bc3cbc commit 7b70afeCopy full SHA for 7b70afe
src/lib/utils.ts
@@ -47,7 +47,13 @@ function getGroup(differenceInMs: number, promptDate: Date): string {
47
}
48
49
export function groupPromptsByRelativeDate(prompts: Prompt[]) {
50
- const grouped = prompts.reduce((groups, prompt) => {
+ const promptsSorted = prompts.sort(
51
+ (a, b) =>
52
+ new Date(b.conversation_timestamp).getTime() -
53
+ new Date(a.conversation_timestamp).getTime()
54
+ );
55
+
56
+ const grouped = promptsSorted.reduce((groups, prompt) => {
57
const promptDate = new Date(prompt.conversation_timestamp);
58
const now = new Date();
59
const differenceInMs = now.getTime() - promptDate.getTime();
0 commit comments