Files
Brandy Carney 05c7b8f0d7 docs(demos): update API demos so they all have ion-navs
- add spacing between imports
- alphabetize imports
- removed app.html files in favor of an inline ion-nav
- cleaned up config demo so it uses proper syntax
- use file name main.html for the first page for the demo
- name the app ApiDemoApp and first page ApiDemoPage
- replace the ion-toolbars with ion-navbars

closes #7019
closes driftyco/ionic-site#647
2016-06-22 14:45:49 -04:00

76 lines
1.6 KiB
TypeScript

import { Component } from '@angular/core';
import { ionicBootstrap } from 'ionic-angular';
@Component({
templateUrl: 'main.html'
})
class ApiDemoPage {
wwwReleased = '1991';
netscapeReleased = '1994-12-15T13:47:20.789';
operaReleased = '1995-04-15';
webkitReleased = '1998-11-04T11:06Z';
firefoxReleased = '2002-09-23T15:03:46.789';
chromeReleased = '2008-09-02';
tokyoTime: string;
parisTime: string;
madisonTime: string;
alertTime = '10:15';
operaShortDay = [
's\u00f8n',
'man',
'tir',
'ons',
'tor',
'fre',
'l\u00f8r'
];
constructor() {
this.tokyoTime = this.calculateTime('+9');
this.parisTime = this.calculateTime('+1');
this.madisonTime = this.calculateTime('-6');
// If it is Daylight Savings Time
if (this.dst(new Date())) {
this.parisTime = this.calculateTime('+2');
this.madisonTime = this.calculateTime('-5');
}
}
calculateTime(offset) {
// create Date object for current location
let d = new Date();
// create new Date object for different city
// using supplied offset
let nd = new Date(d.getTime() + (3600000 * offset));
return nd.toISOString();
}
// Determine if the client uses DST
stdTimezoneOffset(today) {
let jan = new Date(today.getFullYear(), 0, 1);
let jul = new Date(today.getFullYear(), 6, 1);
return Math.max(jan.getTimezoneOffset(), jul.getTimezoneOffset());
}
dst(today) {
return today.getTimezoneOffset() < this.stdTimezoneOffset(today);
}
}
@Component({
template: '<ion-nav [root]="root"></ion-nav>'
})
class ApiDemoApp {
root = ApiDemoPage;
}
ionicBootstrap(ApiDemoApp);