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'
}
}
}
}
}
Here is an example updated to latest angular/ng2-smart-table/etc
https://stackblitz.com/edit/ng-date-picker-smart-table
Important note: you need to update your app.module.ts, and make sure you both declare, and set both the render component / editor as entryComponents:
If you are having any specific errors, let me know and we can try and figure it out. I also updated the readme to add these notes and what I needed to do to make the gist work.