mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
38 lines
734 B
TypeScript
38 lines
734 B
TypeScript
|
import {Component, EventEmitter, Input, Output} from '@angular/core';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'app-timestamp-datepicker',
|
||
|
templateUrl: './datepicker.component.html',
|
||
|
})
|
||
|
export class TimeStampDatePickerComponent {
|
||
|
|
||
|
timestampValue = 0;
|
||
|
@Output() timestampChange = new EventEmitter<number>();
|
||
|
|
||
|
date: Date = new Date();
|
||
|
@Input() name: string;
|
||
|
|
||
|
@Input()
|
||
|
public get timestamp() {
|
||
|
return this.timestampValue;
|
||
|
}
|
||
|
|
||
|
public set timestamp(val: number) {
|
||
|
this.date.setTime(val);
|
||
|
if (this.timestampValue === val) {
|
||
|
return;
|
||
|
}
|
||
|
this.timestampValue = val;
|
||
|
this.timestampChange.emit(this.timestampValue);
|
||
|
}
|
||
|
|
||
|
onChange(date: Date | string) {
|
||
|
this.timestamp = (new Date(date)).getTime();
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|