g1eb / angular-datetime-range

📅 Angular directive for datetime range input
https://rawgit.com/g1eb/angular-datetime-range/master/
MIT License
25 stars 14 forks source link

Calendar displays an extra week (but not always) #6

Closed IbrahimHd closed 7 years ago

IbrahimHd commented 7 years ago

Hi Gleb,

The Calendar displays an extra week in some months, please refer the below snapshot as an example:

image

g1eb commented 7 years ago

Nice find! I've fixed it in v0.2.9 👍

IbrahimHd commented 7 years ago

great 👍

IbrahimHd commented 7 years ago

unfortunately, it's still showing an extra week in the calendar! Plz try to navigate to March 2017 and you can notice the extra week at the bottom

g1eb commented 7 years ago

I've checked this and can't see the extra week in March 2017, here's a screenshot:

screen shot 2017-01-06 at 3 20 54 pm

Are you using the latest version? (v0.2.9)

IbrahimHd commented 7 years ago

it appears in the online demo page (maybe the html/angular code is not updated? image

g1eb commented 7 years ago

Ah.. interesting, because my screen shot was taken on the demo page :)

I suspect a caching issue here, have you tried to clear cache or force-reload the page? (Ctrl + F5 on windows, Command + R on mac)

IbrahimHd commented 7 years ago

Believe me I did it before sending my comment and it still appears at my side in the demo page and my dev enviro as well!! I have v0.2.9

g1eb commented 7 years ago

Hi, is this still an issue? I'd love to look into this but I need something to reproduce this with..

IbrahimHd commented 7 years ago

Unfortunately yes! I'm checking the online demo and it gives extra week (March 2017) on both Chrome and MS Edge and even after cleaning the cache.

g1eb commented 7 years ago

Hi, I've just tested this on IE11 and IE10 and I still can't reproduce this. Maybe this has to do with locale settings on your machine?

Could you tell me specifications of the environment where this issue occurs?

Thanks for testing this, I appreciate your efforts and I want to fix this for you :)

IbrahimHd commented 7 years ago

That's really odd! I can see the extra week (eg. March 2017) on both the online demo and at my local app after cleaning the cache. This is my enviro: OS: Windows 10 Browser: Chrome v55.0.2883.87 (64-bit) Locale/Region: United States

Thanks for your effort!

g1eb commented 7 years ago

Hm, very strange indeed, I've checked this again just now.

Not quite sure what the source of the issue is. Have you tried this on a different machine/environment?

IbrahimHd commented 7 years ago

I'm experiencing this issue in two different computers with almost similar specs.

g1eb commented 7 years ago

Yeah, it's a very strange, I've asked friends to test this for me on their machines and it worked for them. Also tried updating locale settings to us, such as week starts on Sunday etc. all works fine for me :|

Anyways, I've moved getNumWeeks function to calculate number of weeks in a month to directive link function for debugging purposes and pushed it to master. Demo should be updated too, although you might have to clear your cache. Could you please check again? :)

For debugging purposes you can log what getNumWeeks function returns on line 40 in src/datetime-range.js.

PS. If this works I will update the other inputs repo as well, same calendar issue there I believe.

IbrahimHd commented 7 years ago

Hi Gleb,

Sorry for my late reply. The getNumWeeks returns the following:

And getNumWeeks keeps firing every 2 seconds even if the directive is closed.

Hopeful this is informative. Thnx

g1eb commented 7 years ago

Hi! No worries, thank you for looking into with this one with me :)

I'll take another shot at this asap and get back to you!

g1eb commented 7 years ago

Hi there :)

I've updated getNumWeeks functionality to use a new approach to calculate number of weeks in a month, here is a quick fiddle to test: https://jsfiddle.net/3ww30vyt/4/

I've added this feature to the latest version (v0.2.13)

g1eb commented 7 years ago

Closing due to extended period of inactivity and not being able to reproduce this issue in general