diff --git a/src/app/components/unixtime/unixtime.component.ts b/src/app/components/unixtime/unixtime.component.ts index 5c05dac..1800c34 100644 --- a/src/app/components/unixtime/unixtime.component.ts +++ b/src/app/components/unixtime/unixtime.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { MatInputModule } from '@angular/material/input'; import { FormsModule } from '@angular/forms'; +import { Clipboard } from '@angular/cdk/clipboard'; @Component({ selector: 'app-unixtime', standalone: true, @@ -14,12 +15,17 @@ export class UnixtimeComponent implements OnInit { time = ""; utc = ""; + constructor(private clipboard: Clipboard){} + ngOnInit() { let date = Date.now(); this.unixtime = date; this.changed(); + this.clipboard.copy(this.unixtime.toString()); } + + changed() { let date = new Date(this.unixtime); this.date = date.toDateString();