date-time-picker icon indicating copy to clipboard operation
date-time-picker copied to clipboard

No provider

Open Dedme opened this issue 6 years ago • 12 comments

Hello, i am getting "ERROR Error: OwlDateTimePicker: No provider found for DateTimePicker. You must import one of the following modules at your application root: OwlNativeDateTimeModule, OwlMomentDateTimeModule, or provide a custom implementation."

When i navigate to a form that has the control configured. I recently updated from Angular 6 to Angular 7, i have updated package.json to "ng-pick-datetime": "^7.0.0", "ng-pick-datetime-moment": "^1.0.8"

i previously had all a shared module configured as such:

export const MY_NATIVE_FORMATS = {
  fullPickerInput: 'DD MMM YYYY hh:mm',
  datePickerInput: 'DD MMM YYYY',
  timePickerInput: 'hh:mm',
  monthYearLabel: 'MMM YYYY',
  dateA11yLabel: 'DD MMM YYYY',
  monthYearA11yLabel: 'MMM YYYY',
};

@NgModule({
  imports: [
    OwlDateTimeModule,
    OwlMomentDateTimeModule,
  ],
  providers: [{provide: OWL_DATE_TIME_FORMATS, useValue: MY_NATIVE_FORMATS}],
  declarations: [],
  exports: [OwlDateTimeModule, OwlMomentDateTimeModule]
})
export class SharedModule { }

this would be imported into my AppModule. since updating i got the error above, but i have since tried putting this same code into various places. AppModule Only: got error in my other modules that it couldn't find it. AppModule as well: error as above. All Modules: error as above.

Dedme avatar Oct 29 '18 05:10 Dedme

i have rolled back to 1.0.7 for "ng-pick-datetime-moment" and its working correctly now.

Dedme avatar Oct 29 '18 23:10 Dedme

Also getting the same error, reverting to 1.0.7 as described above works..

LukeHartcher avatar Nov 01 '18 02:11 LukeHartcher

Same behaviour with 1.0.8

mstawick avatar Nov 21 '18 08:11 mstawick

Just like you, I recently updated and just need OwlMomentDateTimeModule which used to work fine.

Turns out I was importing: import {OwlMomentDateTimeModule} from 'ng-pick-datetime-moment';

Now it should be: import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

Hope it helps :)

PS: Now you can remove 'ng-pick-datetime-moment' from your package.json

Manbec avatar Jan 19 '19 22:01 Manbec

Just like you, I recently updated and just need OwlMomentDateTimeModule which used to work fine.

Turns out I was importing: import {OwlMomentDateTimeModule} from 'ng-pick-datetime-moment';

Now it should be: import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

Hope it helps :)

PS: Now you can remove 'ng-pick-datetime-moment' from your package.json

This solution does not solve the problem. Is there any fix for this?

JoshuaAlzate avatar Nov 26 '19 03:11 JoshuaAlzate

My comment is from January. I see commits named Angular 8 from 2 months ago. Do you have them updated? For me I had to implement a custom solution as I needed a time picker right away.

Manbec avatar Nov 26 '19 14:11 Manbec

This solution does not work in current master with angular8...

hijamoya avatar Dec 11 '19 06:12 hijamoya

Hi, I am using angular 6 and facing the same problem. Unfortunatly it is not possible to change the version of angular to support OwlMomentDateTimeModule.

Anyone could provide an example with OwlDateTimeModule?

Thank you in advance.

tiagovbarreto avatar Jan 28 '20 17:01 tiagovbarreto

This solution does not work in current master with angular8...

yes its fails in angular 8 in angular 7 it working fine.

Lkirankota avatar May 18 '20 07:05 Lkirankota

The use of:

import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

is not working in angular 9:

Message:

ERROR in node_modules/ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of MyComponentModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module) which declares OwlMomentDateTimeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

hocine15 avatar Jul 24 '20 21:07 hocine15

Please refer the given link for Angular 9 and above:- DanielMoncada/Angular-datetime-picker

Xstream007 avatar Oct 06 '20 08:10 Xstream007

The use of:

import {OwlMomentDateTimeModule} from 'ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module';

is not working in angular 9:

Message:

ERROR in node_modules/ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module.d.ts:3:22 - error NG6002: Appears in the NgModule.imports of MyComponentModule, but could not be resolved to an NgModule class.

This likely means that the library (ng-pick-datetime/date-time/adapter/moment-adapter/moment-date-time.module) which declares OwlMomentDateTimeModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

I am migrate Angular 8.2.14 to 9.1.13 also facing same issue. How to fix?

NaveenKumar24 avatar Dec 16 '23 06:12 NaveenKumar24