File tree Expand file tree Collapse file tree 3 files changed +4
-19
lines changed Expand file tree Collapse file tree 3 files changed +4
-19
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const MOCK_USER: User = {
19
19
signatures : [
20
20
{
21
21
edition : MOCK_EVENT . id ,
22
- day : new Date ( ) . toISOString ( ) ,
22
+ day : new Date ( ) . getDate ( ) . toString ( ) ,
23
23
redeemed : false ,
24
24
signatures : MOCK_ACHIEVEMENTS . filter (
25
25
( a ) => a . kind === "stand" && a . users ?. includes ( "mock_user_id" )
@@ -48,7 +48,7 @@ export const MOCK_OTHER_USER: User = {
48
48
signatures : [
49
49
{
50
50
edition : MOCK_EVENT . id ,
51
- day : new Date ( ) . toISOString ( ) ,
51
+ day : new Date ( ) . getDate ( ) . toString ( ) ,
52
52
redeemed : false ,
53
53
signatures : MOCK_ACHIEVEMENTS . filter (
54
54
( a ) => a . kind === "stand" && a . users ?. includes ( "other_user_id_1" )
Original file line number Diff line number Diff line change 1
1
export function isHereToday ( company : Company ) : boolean {
2
2
const today = new Date ( ) . toISOString ( ) . slice ( 0 , 10 ) ;
3
- return company . stands ?. some ( ( s ) => s . date === today ) || false ;
3
+ return company . stands ?. some ( ( s ) => s . date . slice ( 0 , 10 ) === today ) || false ;
4
4
}
Original file line number Diff line number Diff line change @@ -124,21 +124,6 @@ export function getAchievementFromQRCode(data: string): string | null {
124
124
return JSON . parse ( atob ( data . split ( "sinfo://" ) [ 1 ] ) ) . achievement as string ;
125
125
}
126
126
127
- export function isToday ( date : Date | string ) : boolean {
128
- if ( typeof date === "string" ) {
129
- date = new Date ( date ) ;
130
- if ( isNaN ( date . getTime ( ) ) ) return false ;
131
- }
132
-
133
- const today = new Date ( ) ;
134
-
135
- return (
136
- date . getFullYear ( ) === today . getFullYear ( ) &&
137
- date . getMonth ( ) === today . getMonth ( ) &&
138
- date . getDate ( ) === today . getDate ( )
139
- ) ;
140
- }
141
-
142
127
export function getSessionColor ( sessionKind : string ) {
143
128
switch ( sessionKind ) {
144
129
case "Presentation" :
@@ -154,7 +139,7 @@ export function getSessionColor(sessionKind: string) {
154
139
155
140
export function getUserActiveSignatureData ( user : User , edition : string ) {
156
141
let relevantSignatures = user . signatures ?. find (
157
- ( s ) => s . edition === edition && isToday ( s . day )
142
+ ( s ) => s . edition === edition && new Date ( ) . getDate ( ) . toString ( ) === s . day ,
158
143
) ;
159
144
if ( ! relevantSignatures ) return null ;
160
145
You can’t perform that action at this time.
0 commit comments