Skip to content
This repository was archived by the owner on Mar 2, 2018. It is now read-only.

Commit d1a5086

Browse files
author
Mário Pereira
committed
Bugfix: previous code used moment. To void undefined exceptions, I change the code to not use moment.js
1 parent 0366bdf commit d1a5086

9 files changed

+35
-29
lines changed

app/build/app.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72037,8 +72037,8 @@
7203772037
this.showWeekNumbers = false;
7203872038
this.showTodayShortcut = false;
7203972039
this.showAmPm = false;
72040-
this.useUtc = false;
72041-
this.currToday = false;
72040+
this.useUtc = false; /* check directive */
72041+
this.currToday = false; /* check directive */
7204272042
this.selected$ = new core_1.EventEmitter();
7204372043
this.closing$ = new core_1.EventEmitter();
7204472044
this.locale = datetime_1.NguiDatetime.locale;
@@ -72149,7 +72149,8 @@
7214972149
}
7215072150
if (this.currToday) {
7215172151
if (this.useUtc) {
72152-
this.selectDateTime(moment.tz('UTC').toDate());
72152+
var d = new Date();
72153+
this.selectDateTime(new Date(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()));
7215372154
}
7215472155
else {
7215572156
this.selectDateTime(new Date());
@@ -72318,11 +72319,11 @@
7231872319
__metadata('design:type', Boolean)
7231972320
], NguiDatetimePickerComponent.prototype, "useUtc", void 0);
7232072321
__decorate([
72321-
core_1.Input('current-is-today'),
72322+
/* check directive */ core_1.Input('current-is-today'),
7232272323
__metadata('design:type', Boolean)
7232372324
], NguiDatetimePickerComponent.prototype, "currToday", void 0);
7232472325
__decorate([
72325-
core_1.Output('selected$'),
72326+
/* check directive */ core_1.Output('selected$'),
7232672327
__metadata('design:type', core_1.EventEmitter)
7232772328
], NguiDatetimePickerComponent.prototype, "selected$", void 0);
7232872329
__decorate([
@@ -72403,8 +72404,8 @@
7240372404
this.closeOnSelect = true;
7240472405
this.showTodayShortcut = false;
7240572406
this.isDraggable = true;
72406-
this.useUtc = false;
72407-
this.currToday = false;
72407+
this.useUtc = false; /* Change this attribute to true and the result of currentTime will be present in UTC */
72408+
this.currToday = false; /* Change this attribute to true and the result of currentTime will be with 'today' date */
7240872409
this.ngModelChange = new core_1.EventEmitter();
7240972410
this.valueChanged$ = new core_1.EventEmitter();
7241072411
this.popupClosed$ = new core_1.EventEmitter();
@@ -72774,11 +72775,11 @@
7277472775
__metadata('design:type', Boolean)
7277572776
], NguiDatetimePickerDirective.prototype, "useUtc", void 0);
7277672777
__decorate([
72777-
core_1.Input('current-is-today'),
72778+
/* Change this attribute to true and the result of currentTime will be present in UTC */ core_1.Input('current-is-today'),
7277872779
__metadata('design:type', Boolean)
7277972780
], NguiDatetimePickerDirective.prototype, "currToday", void 0);
7278072781
__decorate([
72781-
core_1.Input('ngModel'),
72782+
/* Change this attribute to true and the result of currentTime will be with 'today' date */ core_1.Input('ngModel'),
7278272783
__metadata('design:type', Object)
7278372784
], NguiDatetimePickerDirective.prototype, "ngModel", void 0);
7278472785
__decorate([
@@ -82729,7 +82730,7 @@
8272982730
//noinspection TypeScriptCheckImport
8273082731
var datetime_picker_1 = __webpack_require__(341);
8273182732
moment['locale']('en-ca'); //e.g. fr-ca
82732-
var templateStr = "\n <div id=\"my-div\">\n <h1>Ng2 DateTime Picker Test</h1>\n \n <fieldset id=\"test2\"><legend><h2>min date, max date, disabled dates</h2></legend>\n <ngui-utils-2>\n <input\n [(ngModel)]=\"date2\" \n ngui-datetime-picker\n [disabled-dates]=\"date2DisabledDates\"\n [min-date]=\"date2MinDate\"\n [max-date]=\"date2MaxDate\"\n [show-close-layer]=\"true\"\n [show-week-numbers]=\"true\"\n [is-draggable]=\"false\"\n date-only=\"true\"/>\n date2: {{date2}}\n <button id=\"set-date\" (click)=\"date2 = date2New\">Set 2017-12-31</button>\n </ngui-utils-2>\n <pre>{{templateStr | htmlCode:'ngui-utils-2'}}</pre>\n </fieldset>\n \n <fieldset id=\"test3\"><legend><h2>time only</h2></legend>\n <ngui-utils-4>\n <input [(ngModel)]=\"date3\"\n ngui-datetime-picker \n date-format=\"DD-MM-YYYY hh:mm\"\n time-only=\"true\"\n minute-step=\"5\"\n (popupClosed)=\"onDatetimePickerClosed()\"\n [close-on-select]=\"false\" />\n </ngui-utils-4>\n <button (click)=\"date3='Thu Jan 31 2015 00:00:00 GMT-0500 (EST)'\">Change</button>\n <pre>{{templateStr | htmlCode:'ngui-utils-4'}}</pre>\n </fieldset>\n \n <fieldset id=\"test4\"><legend><h2>with timezone</h2></legend>\n <ngui-utils-6>\n <input \n [(ngModel)]=\"date4\" \n ngui-datetime-picker\n [date-format]=\"date4TimezoneFormat\" />\n dateWithTimezone: {{dateWithTimezone}}\n <br/>\n </ngui-utils-6>\n <pre>{{templateStr | htmlCode:'ngui-utils-6'}}</pre>\n </fieldset>\n \n <fieldset id=\"test5\"><legend><h2>Reactive form</h2></legend>\n <ngui-utils-3>\n <form [formGroup]=\"myForm\">\n <input \n required\n formControlName=\"date\" \n ngui-datetime-picker\n [close-on-select]=\"false\"\n [use-utc]=\"true\"\n [current-is-today]=\"true\"/>\n </form>\n myForm.controls.date.value: {{myForm.controls.date.value}}\n <br/>myForm.value: {{myForm.value | json}}\n <br/>myForm.dirty: {{myForm.dirty}}\n <br/>myForm.controls.date.dirty: {{myForm.controls.date.dirty}}\n <br/>\n <a href=\"javascript:void()\" \n (click)=\"myForm.controls.date.patchValue('2015-06-30')\">\n 2015-06-30\n </a>\n <a href=\"javascript:void()\"\n (click)=\"myForm.controls.date.patchValue('2015-07-19')\">\n 2015-07-19\n </a>\n <a href=\"javascript:void()\"\n (click)=\"myForm.controls.date.patchValue('2015-12-31')\">\n 2015-12-31\n </a>\n </ngui-utils-3>\n <pre>{{templateStr | htmlCode:'ngui-utils-3'}}</pre>\n </fieldset>\n\n <fieldset id=\"test6\">\n <legend><h2>Material Design</h2></legend>\n <ngui-utils-4>\n <md-input-container>\n <input mdInput \n [(ngModel)]=\"mdDate\"\n name=\"mdDate\"\n ngui-datetime-picker\n date-only=\"true\" \n [close-on-select]=\"false\" />\n </md-input-container>\n </ngui-utils-4>\n </fieldset>\n\n </div>\n";
82733+
var templateStr = "\n <div id=\"my-div\">\n <h1>Ng2 DateTime Picker Test</h1>\n \n <fieldset id=\"test2\"><legend><h2>min date, max date, disabled dates</h2></legend>\n <ngui-utils-2>\n <input\n [(ngModel)]=\"date2\" \n ngui-datetime-picker\n [disabled-dates]=\"date2DisabledDates\"\n [min-date]=\"date2MinDate\"\n [max-date]=\"date2MaxDate\"\n [show-close-layer]=\"true\"\n [show-week-numbers]=\"true\"\n [is-draggable]=\"false\"\n date-only=\"true\"/>\n date2: {{date2}}\n <button id=\"set-date\" (click)=\"date2 = date2New\">Set 2017-12-31</button>\n </ngui-utils-2>\n <pre>{{templateStr | htmlCode:'ngui-utils-2'}}</pre>\n </fieldset>\n \n <fieldset id=\"test3\"><legend><h2>time only</h2></legend>\n <ngui-utils-4>\n <input [(ngModel)]=\"date3\"\n ngui-datetime-picker \n date-format=\"DD-MM-YYYY hh:mm\"\n time-only=\"true\"\n minute-step=\"5\"\n (popupClosed)=\"onDatetimePickerClosed()\"\n [close-on-select]=\"false\" />\n </ngui-utils-4>\n <button (click)=\"date3='Thu Jan 31 2015 00:00:00 GMT-0500 (EST)'\">Change</button>\n <pre>{{templateStr | htmlCode:'ngui-utils-4'}}</pre>\n </fieldset>\n \n <fieldset id=\"test4\"><legend><h2>with timezone</h2></legend>\n <ngui-utils-6>\n <input \n [(ngModel)]=\"date4\" \n ngui-datetime-picker\n [date-format]=\"date4TimezoneFormat\" />\n dateWithTimezone: {{dateWithTimezone}}\n <br/>\n </ngui-utils-6>\n <pre>{{templateStr | htmlCode:'ngui-utils-6'}}</pre>\n </fieldset>\n \n <fieldset id=\"test5\"><legend><h2>Reactive form</h2></legend>\n <ngui-utils-3>\n <form [formGroup]=\"myForm\">\n <input \n required\n formControlName=\"date\" \n ngui-datetime-picker\n [close-on-select]=\"false\"/>\n </form>\n myForm.controls.date.value: {{myForm.controls.date.value}}\n <br/>myForm.value: {{myForm.value | json}}\n <br/>myForm.dirty: {{myForm.dirty}}\n <br/>myForm.controls.date.dirty: {{myForm.controls.date.dirty}}\n <br/>\n <a href=\"javascript:void()\" \n (click)=\"myForm.controls.date.patchValue('2015-06-30')\">\n 2015-06-30\n </a>\n <a href=\"javascript:void()\"\n (click)=\"myForm.controls.date.patchValue('2015-07-19')\">\n 2015-07-19\n </a>\n <a href=\"javascript:void()\"\n (click)=\"myForm.controls.date.patchValue('2015-12-31')\">\n 2015-12-31\n </a>\n </ngui-utils-3>\n <pre>{{templateStr | htmlCode:'ngui-utils-3'}}</pre>\n </fieldset>\n\n <fieldset id=\"test6\">\n <legend><h2>Material Design</h2></legend>\n <ngui-utils-4>\n <md-input-container>\n <input mdInput \n [(ngModel)]=\"mdDate\"\n name=\"mdDate\"\n ngui-datetime-picker\n date-only=\"true\" \n [close-on-select]=\"false\" />\n </md-input-container>\n </ngui-utils-4>\n </fieldset>\n\n </div>\n";
8273382734
var DirectiveTestComponent = (function () {
8273482735
function DirectiveTestComponent(fb) {
8273582736
this.fb = fb;

app/build/app.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/datetime-picker.component.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/datetime-picker.component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/datetime-picker.directive.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)