Issues (5)

src/index.js (3 issues)

1
export class Eloi {
2
    constructor(OriginalDate = Date, { global = true } = {}) {
3
        this._OriginalDate = OriginalDate;
4
        this._setGlobal = global;
5
    }
6
7
    shift(offsetMs) {
8
        const OriginalDate = this._OriginalDate;
0 ignored issues
show
The constant OriginalDate seems to be never used. Consider removing it.
Loading history...
9
10
        this._EloiDate = class extends OriginalDate {
11
            constructor(...args) {
12
                if (args.length === 0) {
13
                    super(OriginalDate.now() + offsetMs);
0 ignored issues
show
The variable OriginalDate seems to be never declared. If this is a global, consider adding a /** global: OriginalDate */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
14
                } else {
15
                    super(...args);
16
                }
17
            }
18
19
            static now() {
20
                return OriginalDate.now() + offsetMs;
0 ignored issues
show
The variable OriginalDate seems to be never declared. If this is a global, consider adding a /** global: OriginalDate */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
21
            }
22
        };
23
24
        if (this._setGlobal) {
25
            global.Date = this._EloiDate;
26
        }
27
28
        return this._EloiDate;
29
    }
30
31
    reset() {
32
        if (this._setGlobal) {
33
            global.Date = this._OriginalDate;
34
        }
35
    }
36
}
37
38
export default new Eloi();
39