Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

$mdUtil: now is not a function #3762

Closed
Closed
@poltorak

Description

@poltorak

I got error on my project: Property 'now' of object # is not a function

I found out that it happens only on devices with Android 4.0 - 4.2. I also found out that it happens here.

Problem is that I can't reproduce it. I can't tell more details because that error occurs only on production where all js files are uglified.

Can someone help or has the same problem?

EDIT:
Method now from $mdUtil looks like:

now: window.performance ?
      angular.bind(window.performance, window.performance.now) :
      Date.now,

and on caniuse.com I found that neither window.performance.now and Date.now are not supported in Android 4.1 - 4.3

EDIT 2:
Simple solution is to check if window.performance and Date.now is available for example

if (window.performance) {
    angular.bind(window.performance, window.performance.now);
    } else if (Date.now) {
        Date.now;
    } else {
        function() {
            return new Date().getTime();
        };
    }

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions