-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmain-page.ts
50 lines (47 loc) · 1.43 KB
/
main-page.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { EventData } from "data/observable";
import { Page } from "ui/page";
import { DateTimeFormat } from "nativescript-intl";
import { fromObject, Observable } from "data/observable";
let model: Observable;
let mediumDateTimeOptions = {
"year": "numeric",
"month": "short",
"day": "numeric",
"hour": "numeric",
"minute": "2-digit",
"second": "numeric"
};
let longDateOptions = {
"year": "numeric",
"month": "long",
"day": "numeric"
};
let fullDateOptions = {
"year": "numeric",
"month": "long",
"day": "numeric",
"weekday": "long"
};
let shortDateTimeOptions = {
"year": "numeric",
"month": "numeric",
"day": "numeric",
"hour": "numeric",
"minute": "numeric"
};
export function onNavigating(args: EventData) {
let page = <Page>args.object;
model = fromObject({
"mediumDateTimeOptions": "",
"longDateOptions": "",
"fullDateOptions": "",
"shortDateTimeOptions": ""
});
page.bindingContext = model;
}
export function onTap() {
model.set("mediumDateTimeOptions", new DateTimeFormat("en-US", mediumDateTimeOptions).format(new Date()));
model.set("longDateOptions", new DateTimeFormat("en-US", longDateOptions).format(new Date()));
model.set("fullDateOptions", new DateTimeFormat("en-US", fullDateOptions).format(new Date()));
model.set("shortDateTimeOptions", new DateTimeFormat("en-US", shortDateTimeOptions).format(new Date()));
}