@@ -5,7 +5,13 @@ import { commitSession } from "./sessionStorage.server";
55
66export const SESSION_ISSUED_AT_KEY = "session:issuedAt" ;
77
8- export const DEFAULT_SESSION_DURATION_SECONDS = 60 * 60 * 24 * 365 ;
8+ // Months and years use standard Gregorian-calendar conversions (365.2425 days/yr,
9+ // 30.436875 days/month) so values produced by external "X months in seconds"
10+ // calculators map cleanly to a labeled option.
11+ const GREGORIAN_YEAR_SECONDS = 31_556_952 ; // 365.2425 * 86400
12+ const GREGORIAN_HALF_YEAR_SECONDS = 15_778_476 ;
13+
14+ export const DEFAULT_SESSION_DURATION_SECONDS = GREGORIAN_YEAR_SECONDS ;
915
1016export type SessionDurationOption = {
1117 value : number ;
@@ -18,8 +24,8 @@ export const SESSION_DURATION_OPTIONS: SessionDurationOption[] = [
1824 { value : 60 * 60 , label : "1 hour" } ,
1925 { value : 60 * 60 * 24 , label : "1 day" } ,
2026 { value : 60 * 60 * 24 * 30 , label : "30 days" } ,
21- { value : 60 * 60 * 24 * 30 * 6 , label : "6 months" } ,
22- { value : 60 * 60 * 24 * 365 , label : "1 year" } ,
27+ { value : GREGORIAN_HALF_YEAR_SECONDS , label : "6 months" } ,
28+ { value : GREGORIAN_YEAR_SECONDS , label : "1 year" } ,
2329] ;
2430
2531export const ALLOWED_SESSION_DURATION_VALUES : ReadonlySet < number > = new Set (
0 commit comments