samuelnygaard / ng2-timezone-selector

A simple Angular module to create a timezone selector using moment-timezone.
https://samuelnygaard.github.io/ng2-timezone-selector/
MIT License
12 stars 12 forks source link

Update to Angular version 5 #4

Closed alexbjorlig closed 6 years ago

alexbjorlig commented 6 years ago

Using this selector in an angular 5 project gives the following warning:

npm WARN ng2-timezone-selector@0.2.3 requires a peer of @angular/core@^4.0.0 but none is installed

samuelnygaard commented 6 years ago

I have tried to investigate this a bit (sorry for the late answer), and i can't reproduce the problem when using it for an Angular 5 app, can you provide the package.json file?

alexbjorlig commented 6 years ago

With the following angular dependencies:

    "@angular/animations": "5.2.9",
    "@angular/cdk": "^5.2.0",
    "@angular/common": "5.2.9",
    "@angular/compiler": "5.2.9",
    "@angular/core": "5.2.9",
    "@angular/flex-layout": "^5.0.0-beta.13",
    "@angular/forms": "5.2.9",
    "@angular/http": "5.2.9",
    "@angular/material": "^5.2.0",
    "@angular/platform-browser": "5.2.9",
    "@angular/platform-browser-dynamic": "5.2.9",
    "@angular/platform-server": "5.2.9",
    "@angular/router": "5.2.9",
    ...
    "ng2-timezone-selector": "^0.2.3",

I get the warning when building the angular project (not serving).

ibuchan72390 commented 6 years ago

Hey there, I actually use this package and like it a lot. This is a simple fix. I would update and make a pull request, but I am rather confused by the structure of your git repo and your multiple package.json files.

in "src/package.json", you have the following line in peerDependencies:

    "@angular/core": "^4.0.0"

That's ensuring the above warning is thrown any time the consuming project references a version of @angular/core outside of the 4.X.X versions. Simply release a new version with

    "@angular/core": "^4.0.0 || ^5.0.0"

and that should clear the error.

samuelnygaard commented 6 years ago

Hi @ibuchan72390, thanks for the fix and the compliment. I'm also a bit annoyed by the structure, it is created with the Yo Generator, but I'm scared of breaking the backward capability if I refactor it. I will push version 0.2.4 with the fix in a bit.

samuelnygaard commented 6 years ago

@dauledk, will you try to update to the latest version: npm i --save ng2-timezone-selector@latest To verify if the issue have been fixed?

alexbjorlig commented 6 years ago

It works - thanks for the help @samuelnygaard and @ibuchan72390 !