Skip to content

Commit

Permalink
fix: 🐛 Added luxon to fix getSchedule (kolplattformen#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohanObrink authored Apr 20, 2021
1 parent 2ae212d commit fe1729c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"publish-package": "npm publish --access public"
},
"dependencies": {
"luxon": "^1.26.0",
"react-redux": "^7.2.3",
"redux": "^4.0.5"
},
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
TimetableEntry,
User,
} from '@skolplattformen/embedded-api'
import { DateTime } from 'luxon'
import {
ApiCall,
EntityHookResult,
Expand Down Expand Up @@ -175,7 +176,7 @@ export const useSchedule = (child: Child, from: string, to: string) => hook<Sche
`schedule_${child.id}_${from}_${to}`,
[],
(s) => 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<TimetableEntry[]>(
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit fe1729c

Please sign in to comment.