From 5f9c1e229ca69358e3c3bd04168956e9030bc178 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 28 Dec 2020 13:07:49 +0100 Subject: [PATCH] root: return API dates as timestamp --- authentik/root/settings.py | 1 + web/src/utils.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 3975f7d8e..3df86786d 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -142,6 +142,7 @@ SWAGGER_SETTINGS = { REST_FRAMEWORK = { "DEFAULT_PAGINATION_CLASS": "authentik.api.pagination.Pagination", "PAGE_SIZE": 100, + 'DATETIME_FORMAT': '%s', "DEFAULT_FILTER_BACKENDS": [ "rest_framework_guardian.filters.ObjectPermissionsFilter", "django_filters.rest_framework.DjangoFilterBackend", diff --git a/web/src/utils.ts b/web/src/utils.ts index 9398fffda..36d6c300b 100644 --- a/web/src/utils.ts +++ b/web/src/utils.ts @@ -50,3 +50,7 @@ export function loading(v: T, actual: TemplateResult): TemplateResult { } return actual; } + +export function time(t: string): Date { + return new Date(parseInt(t, 10) * 1000); +}