Skip to content

ClockDate class overwrite prototype of instance #437

@Oustinger

Description

@Oustinger

ClockDate class overwrite prototype of instance.
In my real project it happens when I use datepicker library (@eonasdan/tempus-dominus).

  • FakeTimers version : 9.1.2
  • Environment : Opera 89.0.4447.64, Windows 10
  • Example URL : repository
  • Other libraries you are using: -

What did you expect to happen?
I expected to receive instance of DateTime with it's methods

What actually happens
Prototype of child instance is not equals to DateTime class, but equals to fake date class

How to reproduce
I'd created a repository with reproducing this problem

i. You can clone and run project
ii. Or you can create project with @sinonjs/fake-timers and run the code below by yourself

var FakeTimers = require("@sinonjs/fake-timers");

FakeTimers.install();

class DateTime extends Date {
    constructor() {
        super();

        this.bar = 'bar';
    }

    foo() {
        console.log('Lorem inpsum');
    }
}

var dateTime = new DateTime();

dateTime.foo();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy