blob: fc8abb9d9590179bb4b37379b91260b8b3f9cb5a (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 | import { Deserializable } from "../client/util/SerializationHelper";
import { serializable, date } from "serializr";
import { ObjectField } from "./ObjectField";
import { Copy, ToScriptString } from "./FieldSymbols";
@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);
    }
    [ToScriptString]() {
        return `new DateField(new Date(${this.date.toISOString()}))`;
    }
}
 |