core: fix logic for token expiration (#9426)
* core: fix logic for token expiration Signed-off-by: Jens Langhammer <jens@goauthentik.io> * bump default token expiration Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix frontend Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
		@ -111,6 +111,21 @@ export function dateTimeLocal(date: Date): string {
 | 
			
		||||
    return `${parts[0]}:${parts[1]}`;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function dateToUTC(date: Date): Date {
 | 
			
		||||
    // Sigh...so our API is UTC/can take TZ info in the ISO format as it should.
 | 
			
		||||
    // datetime-local fields (which is almost the only date-time input we use)
 | 
			
		||||
    // can return its value as a UTC timestamp...however the generated API client
 | 
			
		||||
    // _requires_ a Date object, only to then convert it to an ISO string anyways
 | 
			
		||||
    // JS Dates don't include timezone info in the ISO string, so that just sends
 | 
			
		||||
    // the local time as UTC...which is wrong
 | 
			
		||||
    // Instead we have to do this, convert the given date to a UTC timestamp,
 | 
			
		||||
    // then subtract the timezone offset to create an "invalid" date (correct time&date)
 | 
			
		||||
    // but it still "thinks" it's in local TZ
 | 
			
		||||
    const timestamp = date.getTime();
 | 
			
		||||
    const offset = -1 * (new Date().getTimezoneOffset() * 60000);
 | 
			
		||||
    return new Date(timestamp - offset);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Lit is extremely well-typed with regard to CSS, and Storybook's `build` does not currently have a
 | 
			
		||||
// coherent way of importing CSS-as-text into CSSStyleSheet. It works well when Storybook is running
 | 
			
		||||
// in `dev,` but in `build` it fails. Storied components will have to map their textual CSS imports
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user