https://stackblitz.com/edit/ng-date-picker-smart-table
npm install --save ng-pick-datetime
Add the component in this gist to your project
Add the following packages to your package.json at at least these versions: "ng-pick-datetime": "7.0.0" "ng2-smart-table": "1.5.0"
Add the following to your module:
import { FormsModule } from '@angular/forms';
import { OwlDateTimeModule, OwlNativeDateTimeModule } from 'ng-pick-datetime';
import { SmartTableDatepickerComponent, SmartTableDatepickerRenderComponent } from './your-path-to/smart-table-datepicker.component'
@NgModule({
imports: [
FormsModule,
OwlDateTimeModule,
OwlNativeDateTimeModule,
],
declarations: [
...,
SmartTableDatepickerComponent,
SmartTableDatepickerRenderComponent
],
entryComponents: [
...,
SmartTableDatepickerComponent,
SmartTableDatepickerRenderComponent
],
...
})
Add to your smart table settings:
{
columns: {
startDate: {
title: 'Start Time',
type: 'custom',
renderComponent: SmartTableDatepickerRenderComponent,
width: '250px',
filter: false,
sortDirection: 'desc',
editor: {
type: 'custom',
component: SmartTableDatepickerComponent,
}
},
endDate: {
title: 'End Time',
type: 'custom',
renderComponent: SmartTableDatepickerRenderComponent,
width: '250px',
filter: false,
editor: {
type: 'custom',
component: SmartTableDatepickerComponent,
config: {
placeholder: 'End Time'
}
}
}
}
}
you add it to your settings JSON config the imports will be in your ts file for where the settings are used (if you set up your files as json in the ts in which you are using for the table)