aboutsummaryrefslogtreecommitdiff
path: root/src/models/EventInfo.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/EventInfo.ts')
-rw-r--r--src/models/EventInfo.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/models/EventInfo.ts b/src/models/EventInfo.ts
index d20682c..6fce60b 100644
--- a/src/models/EventInfo.ts
+++ b/src/models/EventInfo.ts
@@ -1,3 +1,9 @@
+interface EventInfoSerializeInfo {
+ days: string,
+ start: number,
+ end: number
+}
+
export default class EventInfo {
days: string;
start: number;
@@ -16,6 +22,10 @@ export default class EventInfo {
this.end = end;
}
+ static fromJSON({days, start, end}: EventInfoSerializeInfo) {
+ return new EventInfo(days, start, end);
+ }
+
static timeToStr(time: number) {
let hour = Math.floor(time / 100);
const minute = time % 100;