Commit 09914f1 1 parent e5d67ee commit 09914f1 Copy full SHA for 09914f1
File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -15,14 +15,21 @@ export const cachedPaninis = unstable_cache(
15
15
} ,
16
16
) ;
17
17
18
+ /**
19
+ * Function to get a new date that is midnight of the current day.
20
+ */
21
+ export function getMidnightDate ( date : Date = new Date ( ) ) {
22
+ return new Date ( date . getFullYear ( ) , date . getMonth ( ) , date . getDate ( ) ) ;
23
+ }
24
+
18
25
export const cachedRecentlySeenPaninis = unstable_cache (
19
26
async ( ) =>
20
27
await prisma . panini . findMany ( {
21
28
where : {
22
29
observations : {
23
30
some : {
24
31
time : {
25
- gte : new Date ( Date . now ( ) - 1000 * 60 * 60 * 24 ) ,
32
+ gte : getMidnightDate ( ) ,
26
33
} ,
27
34
} ,
28
35
} ,
@@ -39,7 +46,7 @@ export const cachedRecentlySeenPaninis = unstable_cache(
39
46
observations : {
40
47
where : {
41
48
time : {
42
- gte : new Date ( Date . now ( ) - 1000 * 60 * 60 * 24 ) ,
49
+ gte : getMidnightDate ( ) ,
43
50
} ,
44
51
} ,
45
52
} ,
You can’t perform that action at this time.
0 commit comments