From fe1729c8729d54e82edc6f287456ffc582e1bdb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20=C3=96brink?= Date: Tue, 20 Apr 2021 10:19:23 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Added=20luxon=20to=20fix?= =?UTF-8?q?=20getSchedule=20(#13)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 ++ src/hooks.ts | 3 ++- yarn.lock | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 17124316..7fd8aa82 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "publish-package": "npm publish --access public" }, "dependencies": { + "luxon": "^1.26.0", "react-redux": "^7.2.3", "redux": "^4.0.5" }, @@ -35,6 +36,7 @@ "@testing-library/react": "^11.2.6", "@testing-library/react-hooks": "^5.1.1", "@types/jest": "^26.0.22", + "@types/luxon": "^1.26.4", "@types/react": "^16.14.3", "@types/react-redux": "^7.1.16", "@typescript-eslint/eslint-plugin": "^4.21.0", diff --git a/src/hooks.ts b/src/hooks.ts index 83f2de34..55fcadf7 100644 --- a/src/hooks.ts +++ b/src/hooks.ts @@ -14,6 +14,7 @@ import { TimetableEntry, User, } from '@skolplattformen/embedded-api' +import { DateTime } from 'luxon' import { ApiCall, EntityHookResult, @@ -175,7 +176,7 @@ export const useSchedule = (child: Child, from: string, to: string) => hook s.schedule, - (api) => () => api.getSchedule(child, from, to), + (api) => () => api.getSchedule(child, DateTime.fromISO(from), DateTime.fromISO(to)), ) export const useTimetable = (child: Skola24Child, week: number, year: number) => hook( diff --git a/yarn.lock b/yarn.lock index edd1c395..3317e34d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1470,6 +1470,11 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= +"@types/luxon@^1.26.4": + version "1.26.4" + resolved "https://registry.yarnpkg.com/@types/luxon/-/luxon-1.26.4.tgz#77bbd5a1aa74ca31edff2aee4f8313ea0d93ca5c" + integrity sha512-OIvbVLZQUjyZofqSFpre2VsgvKy0V0JQdRgN0k3H1DTGRdxHiaQjT16+H2gyuhAS9r8B2PQEwrSiqP6/Zka3pQ== + "@types/node@*": version "14.14.25" resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.25.tgz" @@ -4553,6 +4558,11 @@ luxon@^1.25.0: resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.25.0.tgz#d86219e90bc0102c0eb299d65b2f5e95efe1fe72" integrity sha512-hEgLurSH8kQRjY6i4YLey+mcKVAWXbDNlZRmM6AgWDJ1cY3atl8Ztf5wEY7VBReFbmGnwQPz7KYJblL8B2k0jQ== +luxon@^1.26.0: + version "1.26.0" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-1.26.0.tgz#d3692361fda51473948252061d0f8561df02b578" + integrity sha512-+V5QIQ5f6CDXQpWNICELwjwuHdqeJM1UenlZWx5ujcRMc9venvluCjFb4t5NYLhb6IhkbMVOxzVuOqkgMxee2A== + lz-string@^1.4.4: version "1.4.4" resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz"