Skip to content

Commit

Permalink
fix: fixing class name
Browse files Browse the repository at this point in the history
  • Loading branch information
Farenheith committed Apr 7, 2023
1 parent bfa7bd4 commit 9f4c8c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/methods/base-methods.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SuperDate } from '../sonic-date';
import { SonicDate } from '../sonic-date';
import { scales } from './constants';

const DATE_SIZE = 10;
const { addMinutes } = scales;

export function clone(this: Date) {
return new SuperDate(this.getTime());
return new SonicDate(this.getTime());
}

export function startOfDay<T extends Date>(this: T) {
Expand Down
10 changes: 5 additions & 5 deletions src/sonic-date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import * as methods from './methods';

export type Dateable = Date | number | string;

export class SuperDate extends Date {
export class SonicDate extends Date {
constructor(date?: Dateable) {
if (date) super(date);
else super();
}
}
export interface SuperDate {
clone(): SuperDate;
export interface SonicDate {
clone(): SonicDate;
isAfter(dateToCompare: Dateable): boolean;
isBefore(dateToCompare: Dateable): boolean;
addMilliseconds(amount: number): this;
Expand All @@ -24,7 +24,7 @@ export interface SuperDate {
}

(Object.keys(methods) as Array<keyof typeof methods>).forEach((method) => {
(SuperDate.prototype[
(SonicDate.prototype[
method
] as unknown as typeof SuperDate.prototype[typeof method]) = methods[method];
] as unknown as typeof SonicDate.prototype[typeof method]) = methods[method];
});
4 changes: 2 additions & 2 deletions test/benchmarks/date-lib.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Benchmark = require('benchmark');
import { utc } from 'moment';
import { addDays, startOfDay } from 'date-fns';
import { SuperDate } from 'src/index';
import { SonicDate } from 'src/index';

const benchmarkSuite = new Benchmark.Suite();

Expand All @@ -16,7 +16,7 @@ describe('General benchmark', () => {
}
function usingCustom(date?: Date) {
// date ??= new Date();
return new SuperDate(date)
return new SonicDate(date)
.addHours(10 * 24)
.startOfDay()
.toISOString();
Expand Down

0 comments on commit 9f4c8c9

Please sign in to comment.