aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/DateField.ts
blob: c0a79f26720e03854d62941b3bf652b2311ee47f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { Deserializable } from "../client/util/SerializationHelper";
import { serializable, date } from "serializr";
import { ObjectField, Copy } from "./ObjectField";

@Deserializable("date")
export class DateField extends ObjectField {
    @serializable(date())
    readonly date: Date;

    constructor(date: Date = new Date()) {
        super();
        this.date = date;
    }

    [Copy]() {
        return new DateField(this.date);
    }
}