Skip to content

Commit

Permalink
fix(timepicker): need keep source date (#UIM-79) (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
lskramarov authored and pimenovoleg committed Jul 18, 2019
1 parent 0e5e3b0 commit 9ba7050
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 94 deletions.
2 changes: 1 addition & 1 deletion packages/mosaic-dev/timepicker/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const moment = _rollupMoment || _moment;
encapsulation: ViewEncapsulation.None
})
export class TimepickerDemoComponent {
timeValue1: Moment = moment();
timeValue: Moment = moment('2000-10-01 12:00:00');
isDisabled: boolean = false;

toggleDisable() {
Expand Down
12 changes: 6 additions & 6 deletions packages/mosaic-dev/timepicker/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h3 class="mc-title">Example 1</h3>
<mc-form-field >
<i mcPrefix mc-icon="mc-clock_16" color="second"></i>
<input mcTimepicker
[(ngModel)]="timeValue1"
[(ngModel)]="timeValue"
time-format="HH:mm:ss"
min-time="10:00:00"
max-time="13:30:00"
Expand All @@ -30,14 +30,14 @@ <h3 class="mc-title">Example 1</h3>

<br>

<p class="mc-caption_mono" *ngIf="timeValue1 !== null">
<p class="mc-caption_mono" *ngIf="timeValue !== null">
Current time value:
{{timeValue1.hours()}}:
{{timeValue1.minutes()}}:
{{timeValue1.seconds()}}
{{timeValue.hours()}}:
{{timeValue.minutes()}}:
{{timeValue.seconds()}}
</p>

<p class="mc-caption_mono" *ngIf="timeValue1 === null"> Incorrect input - null result</p>
<p class="mc-caption_mono" *ngIf="timeValue === null"> Incorrect input - null result</p>

<br>

Expand Down
5 changes: 3 additions & 2 deletions packages/mosaic-moment-adapter/adapter/moment-date-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,9 @@ export class MomentDateAdapter extends DateAdapter<Moment> {
return result;
}

createDateTime(year: number, month: number, date: number,
hours: number, minutes: number, seconds: number, milliseconds: number): Moment {
createDateTime(
year: number, month: number, date: number, hours: number, minutes: number, seconds: number, milliseconds: number
): Moment {
const newDate = this.createDate(year, month, date);

newDate.hours(hours);
Expand Down
Loading

0 comments on commit 9ba7050

Please sign in to comment.