SchoolUtils / WebUntis

JavaScript WebUntis API Client
https://webuntis.noim.me/
MIT License
159 stars 21 forks source link

New function #27

Closed luwol03 closed 4 years ago

luwol03 commented 4 years ago

Hello, I need a function for converting a untis date into js date object.

TheNoim commented 4 years ago

Ok, this is not that hard. I will do this later.

luwol03 commented 4 years ago

I know, I do this with a function like that function convert(untisdate) { var ud = untisdate.toString(); return new Date(ud.substr(0,4) + '.' + ud.substr(4,2) + '.' + ud.substr(6,2)); } but it will be a nice feature, if it is intecraded in the lib.

TheNoim commented 4 years ago

Implemented both (time and date) in https://github.com/TheNoim/WebUntis/commit/adf606b743e44b9c994362f2ed22bea0bdc26c93

luwol03 commented 4 years ago

i do this e.jsdate = untis.convertUntisDate(e.date); and i get this error (node:6268) UnhandledPromiseRejectionWarning: TypeError: untis.convertUntisDate is not a function at data.forEach.e (c:\Users\wolflu\Desktop\UntisAPI\index.js:40:39) at Array.forEach (<anonymous>) at untis.getOwnTimetableForRange.then (c:\Users\wolflu\Desktop\UntisAPI\index.js:33:18) at process._tickCallback (internal/process/next_tick.js:68:7) warning.js:18 (node:6268) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4) what I do wrong? I have installed this version: webuntis@1.10.0

luwol03 commented 4 years ago

Oh, I now my problem, i had to do e.jsdate = WebUntisLib.convertUntisDate(e.date) because untis is my object whith will be created by login and not the variable which I set by require. Thank you for this quickly change. I don't know any faster guys than you. Thank You

luwol03 commented 4 years ago

Can you tell my how big the api pdf is?

TheNoim commented 4 years ago

277kb

luwol03 commented 4 years ago

Thanks, but I mean the number of pages

dunklesToast commented 4 years ago

@TheNoim are using an older version. It's 13 pages and you can request it via Untis Helpdesk

luwol03 commented 4 years ago

ok thank you very much, because I am considering whether I should inquire