Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

Commit

Permalink
close #37 #45 #47 #48 #51
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikola Kalinov committed Sep 23, 2016
1 parent 1d8cc4b commit 7915429
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 170 deletions.
68 changes: 17 additions & 51 deletions demo/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ <h3 class="panel-title">
</h3>
</div>
<div class="panel-body">
<p>
<code>&lt;datetime [(ngModel)]="date">&lt;/datetime></code>
</p>
<pre><code>&lt;datetime [(ngModel)]="date">&lt;/datetime></code></pre>
<datetime [(ngModel)]="date"></datetime>
<h5><strong>ngModel:</strong> {{getDate(date) | date: "medium"}}</h5>
</div>
Expand All @@ -27,9 +25,7 @@ <h3 class="panel-title">
</h3>
</div>
<div class="panel-body">
<p>
<code>&lt;datetime [datepicker]="false" [(ngModel)]="date3">&lt;/datetime></code>
</p>
<pre><code>&lt;datetime [datepicker]="false" [(ngModel)]="date3">&lt;/datetime></code></pre>
<datetime [datepicker]="false" [(ngModel)]="date3"></datetime>
<h5><strong>ngModel:</strong> {{getDate(date3) | date: "medium"}}</h5>
</div>
Expand All @@ -43,16 +39,13 @@ <h3 class="panel-title">
</h3>
</div>
<div class="panel-body">
<p>
<code>&lt;datetime [timepicker]="false" [(ngModel)]="date3">&lt;/datetime></code>
</p>
<pre><code>&lt;datetime [timepicker]="false" [(ngModel)]="date3">&lt;/datetime></code></pre>
<datetime [timepicker]="false" [(ngModel)]="date3"></datetime>
<h5><strong>ngModel:</strong> {{getDate(date3) | date: "medium"}}</h5>
</div>
</section>
</div>
</div>
<!--
<h2>Options</h2>
<section>
<div class="row">
Expand Down Expand Up @@ -129,25 +122,17 @@ <h4>
<section class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Setting options</h3></div>
<div class="panel-body">
<code>
&lt;datetime [timepicker]="{ showMeridian: false, minuteStep: 1 }"
[datepicker]="datepickerOpts"
[(ngModel)]="date2">&lt;/datetime>
</code>
<br>
<pre><code>&lt;datetime [timepicker]="&#123; showMeridian: false, minuteStep: 1 &#125;" [datepicker]="datepickerOpts" [(ngModel)]="date2">&lt;/datetime></code></pre>
In your component:<br>
<code>
date2: Date = new Date(2016, 5, 10);
datepickerOpts = {
startDate: new Date(2016, 5, 10),
autoclose: true,
todayBtn: 'linked',
todayHighlight: true,
assumeNearbyYear: true,
format: 'D, d MM yyyy'
}
</code>
<pre><code>date2: Date = new Date(2016, 5, 10);
datepickerOpts = &#123;
startDate: new Date(2016, 5, 10),
autoclose: true,
todayBtn: 'linked',
todayHighlight: true,
assumeNearbyYear: true,
format: 'D, d MM yyyy'
&#125;</code></pre>
<datetime [(ngModel)]="date2"
[timepicker]="{showMeridian: false, minuteStep: 1}"
[datepicker]="datepickerOpts"></datetime>
Expand All @@ -161,11 +146,7 @@ <h3 class="panel-title">
</h3>
</div>
<div class="panel-body">
<p>
<code>&lt;datetime [(ngModel)]="date4" [timepicker]="{icon: 'fa fa-clock-o'}"
[datepicker]="{icon: 'fa
fa-calendar'}">&lt;/datetime></code>
</p>
<pre><code>&lt;datetime [(ngModel)]="date4" [timepicker]="&#123; icon: 'fa fa-clock-o' &#125;" [datepicker]="&#123; icon: 'fa fa-calendar' &#125;">&lt;/datetime></code></pre>
<datetime [(ngModel)]="date4" [timepicker]="{icon: 'fa fa-clock-o'}"
[datepicker]="{icon: 'fa fa-calendar'}"></datetime>
<h5><strong>ngModel:</strong> {{getDate(date4) | date: "medium"}}</h5>
Expand All @@ -175,18 +156,8 @@ <h2>Examples</h2>
<section class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">From-To (WIP)</h3></div>
<div class="panel-body">
<p>
<code>
&lt;datetime [ngModel]="dateFrom"
(ngModelChange)="handleDateFromChange($event)"
[timepicker]="false">&lt;/datetime>
</code><br>
<code>
&lt;datetime [(ngModel)]="dateTo"
[timepicker]="false"
[datepicker]="datepickerToOpts">&lt;/datetime>
</code>
</p>
<pre><code>&lt;datetime [ngModel]="dateFrom" (ngModelChange)="handleDateFromChange($event)" [timepicker]="false">&lt;/datetime></code></pre>
<pre><code>&lt;datetime [(ngModel)]="dateTo" [timepicker]="false" [datepicker]="datepickerToOpts">&lt;/datetime></code></pre>
<datetime [ngModel]="dateFrom"
style="float: left"
(ngModelChange)="handleDateFromChange($event)"
Expand All @@ -201,14 +172,9 @@ <h5><strong>dateTo:</strong> {{getDate(dateTo) | date: "medium"}}</h5>
<section class="panel panel-default">
<div class="panel-heading"><h3 class="panel-title">Clear button</h3></div>
<div class="panel-body">
<p>
<code>
&lt;datetime [(ngModel)]="date5" [hasClearButton]="true">&lt;/datetime>
</code>
</p>
<pre><code>&lt;datetime [(ngModel)]="date5" [hasClearButton]="true">&lt;/datetime></code></pre>
<datetime [(ngModel)]="date5" [hasClearButton]="true"></datetime>
<h5><strong>ngModel:</strong> {{getDate(date5) | date: "medium"}}</h5>
</div>
</section>
-->
</main>
2 changes: 1 addition & 1 deletion demo/app.component.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions demo/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import { Component } from '@angular/core';

@Component({
selector: 'my-app',
Expand Down Expand Up @@ -32,7 +32,7 @@ export class AppComponent {
};
}

public getDate(dt): number {
getDate(dt): number {
return dt && dt.getTime();
}
}
2 changes: 1 addition & 1 deletion demo/app.module.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 7 additions & 6 deletions demo/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component';
import {NKDatetimeModule} from '../src/ng2-datetime/ng2-datetime.module';
import { NKDatetimeModule } from '../src/ng2-datetime/ng2-datetime.module';

@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, FormsModule, NKDatetimeModule],
bootstrap: [AppComponent],
imports: [BrowserModule, FormsModule, NKDatetimeModule],
bootstrap: [AppComponent],
})
export class AppModule {}
export class AppModule {
}
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,28 @@
<link rel="stylesheet" href="src/vendor/bootstrap-timepicker/bootstrap-timepicker.min.css">
<link rel="stylesheet" href="src/vendor/bootstrap-datepicker/bootstrap-datepicker3.min.css">
<link rel="stylesheet" href="demo/styles.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/idea.min.css">

<!-- 1. Load libraries -->
<!-- Polyfill(s) for older browsers -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.0/shim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.12/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/shim.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.6.23/zone.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/reflect-metadata/0.1.3/Reflect.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.31/system.js"></script>

<script src="https://code.jquery.com/jquery-3.1.0.min.js"
integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
<script src="src/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
<script src="src/vendor/bootstrap-timepicker/bootstrap-timepicker.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>

<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('demo').catch(function (err) {
console.error(err);
});
hljs.initHighlightingOnLoad();
</script>
</head>

Expand Down
2 changes: 2 additions & 0 deletions ng2-datetime.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './src/ng2-datetime/ng2-datetime';
export * from './src/ng2-datetime/ng2-datetime.module';
3 changes: 2 additions & 1 deletion ng2-datetime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ng2-datetime.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion ng2-datetime.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export {NKDatetime, NKDatetimeModule} from './src/ng2-datetime/ng2-datetime';
export { NKDatetime } from './src/ng2-datetime/ng2-datetime';
export { NKDatetimeModule } from './src/ng2-datetime/ng2-datetime.module';
28 changes: 13 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.1.5",
"description": "Bootstrap datetime picker for Angular2",
"main": "ng2-datetime.js",
"typings": "ng2-datetime.d.ts",
"keywords": [
"angular2",
"ng2",
Expand All @@ -15,29 +16,29 @@
"author": "Nikola Kalinov <hello@nkalinov.com> (http://nkalinov.com)",
"scripts": {
"start": "concurrently \"npm run tsc:w\" \"npm run lite\" ",
"tsc": "tsc",
"tsc:w": "tsc -w",
"lite": "lite-server",
"postinstall": "typings install",
"test": "node ./node_modules/.bin/karma start"
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/nkalinov/ng2-datetime.git"
},
"dependencies": {
"@angular/common": "2.0.0-rc.5",
"@angular/compiler": "2.0.0-rc.5",
"@angular/core": "2.0.0-rc.5",
"@angular/forms": "^0.3.0",
"@angular/platform-browser": "2.0.0-rc.5",
"@angular/platform-browser-dynamic": "^2.0.0-rc.5",
"core-js": "^2.4.0",
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.6",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.27",
"zone.js": "^0.6.12",
"zone.js": "^0.6.23",
"jquery": "^2.2.1",
"bootstrap": "^3.3.6",
"bootstrap-datepicker": "^1.6.0",
Expand All @@ -54,8 +55,5 @@
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10"
},
"peerDependencies": {
"typings": "*"
}
}
15 changes: 0 additions & 15 deletions src/ng2-datetime/ng2-datetime.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7915429

Please sign in to comment.