Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: response.currentTime.getTime is not a function #58

Open
GrumpyMeow opened this issue Jun 23, 2022 · 1 comment
Open

TypeError: response.currentTime.getTime is not a function #58

GrumpyMeow opened this issue Jun 23, 2022 · 1 comment

Comments

@GrumpyMeow
Copy link

GrumpyMeow commented Jun 23, 2022

Hi,

I just received a new camera which should support Onvif. It does, but initially an error is triggered.
I did some digging around and found a workaround by patching node_modules/onvif/lib/events.js.
Apparently the package "onvif" does not correctly parse the response and not parse date.
This patch worked:

function _terminationTime(response) {
                if (typeof response.currentTime === "string") {
                   response.currentTime = new Date(Date.parse(response.currentTime));
                }    
                if (typeof response.terminationTime === "string") {
                   response.terminationTime = new Date(Date.parse(response.terminationTime));
                }   
                return new Date(Date.now() - response.currentTime.getTime() + response.terminationTime.getTime());
        }
@Kepro
Copy link

Kepro commented Nov 30, 2022

@GrumpyMeow update onvif package to the latest version... 0.6.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants