Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(date-time picker): add dateTimeChange output #3081

Open
wants to merge 1 commit into
base: 8.0.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/structure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ export const structure = [
'NbDatepickerDirective',
'NbDatepickerComponent',
'NbRangepickerComponent',
'NbDateTimePickerComponent',
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import {
ChangeDetectionStrategy,
Component,
ComponentFactoryResolver,
EventEmitter,
Inject,
Input,
OnInit,
Optional,
Output,
Type,
} from '@angular/core';
import { Observable } from 'rxjs';
Expand All @@ -21,6 +23,10 @@ import { NbCalendarWithTimeComponent } from './calendar-with-time.component';
import { NbBasePickerComponent } from './datepicker.component';
import { NB_DATE_SERVICE_OPTIONS } from './datepicker.directive';

/**
* The DateTimePicker component itself.
* Provides a proxy to `NbCalendarWithTimeComponent` options as well as custom picker options.
*/
@Component({
selector: 'nb-date-timepicker',
template: '',
Expand Down Expand Up @@ -48,11 +54,19 @@ export class NbDateTimePickerComponent<D> extends NbBasePickerComponent<D, D, Nb
}
}

/**
* Defines minutes step when we use fill time format.
* If set to 20, it will be: '12:00, 12:20: 12:40, 13:00...'
*/
@Input() step: number;

@Input() title: string;
@Input() applyButtonText: string;
@Input() currentTimeButtonText: string;

/**
* Defines 12 hours format like '07:00 PM'.
*/
@Input()
get twelveHoursFormat(): boolean {
return this._twelveHoursFormat;
Expand All @@ -63,6 +77,10 @@ export class NbDateTimePickerComponent<D> extends NbBasePickerComponent<D, D, Nb
_twelveHoursFormat: boolean;
static ngAcceptInputType_twelveHoursFormat: NbBooleanInput;

/**
* Show seconds in timepicker.
* Ignored when singleColumn is true.
*/
@Input()
get withSeconds(): boolean {
return this._withSeconds;
Expand All @@ -83,6 +101,13 @@ export class NbDateTimePickerComponent<D> extends NbBasePickerComponent<D, D, Nb
_singleColumn: boolean;
static ngAcceptInputType_singleColumn: NbBooleanInput;

/**
* Emits date with time when selected.
*/
@Output() get dateTimeChange(): EventEmitter<D> {
return this.valueChange as EventEmitter<D>;
}

constructor(@Inject(NB_DOCUMENT) document,
positionBuilder: NbPositionBuilderService,
triggerStrategyBuilder: NbTriggerStrategyBuilderService,
Expand Down