Code Monkey home page Code Monkey logo

Comments (11)

danheron avatar danheron commented on September 7, 2024

I can't recreate this problem - it always looks correct to me.

Do you see this problem in the example on the docs page? If yes, then what browser are you using?

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

yes, in the docs page it is always jumping ahead between the lines, no matter what setting I use. for some reason in my project it jumps only on the lines, but still shows the incorrect time:
grafik

I tested the doc page with different browsers (Edge, Chrome, Firefox), time was 8:40 am:
grafik

could this be a localization issue? I'm in germany.
but I don't see why my project shows something different, while on the same machine (separate VM) it shows the same behavior on the doc page.
either way neither shows the correct time.

from heron.mudcalendar.

danheron avatar danheron commented on September 7, 2024

Yes, it is a localisation issue. I will fix that.

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

thanks

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

I have inserted the fixed code in my project, but unfortunately the time is still not correctly showing, although now the marker seems to move with each minute.

Actual time here is 11:24:
grafik
grafik

It seems so be shifted by about 10 minutes now.

Sorry for bothering.

from heron.mudcalendar.

danheron avatar danheron commented on September 7, 2024

Do you still have this problem? In the example you sent me it looks correct. Do you have the problem in all browsers?

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

Yes, the problem is still there, but as written before, the marker now moves with each minute.

grafik
actual time was 16:20 (I think it is showing 16:35, so it is shifted 15 minutes with each minute)

tested in Firefox, Chrome and Edge, same result

from heron.mudcalendar.

danheron avatar danheron commented on September 7, 2024

That's very strange I can't replicate this problem. Could you try debugging it yourself and see if you can find the problem.

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

As you might have figured out, I'm quite new to Blazor, but I managed to figure out, that the shift is always exactly half of the set interval, so +5 when in 10 minute interval and +30 when in 60 minute interval.

For now I fixed my indicator by changing TimelinePosition() in DayWeekViewBase.razor.cs
from this
var minutes = (int)Math.Floor(DateTime.Now.Subtract(DateTime.Today).TotalMinutes) - (TimelineRow() * (int)Calendar.DayTimeInterval);
to this
var minutes = DateTime.Now.Subtract(DateTime.Today).TotalMinutes - (TimelineRow() * (int)Calendar.DayTimeInterval) - (int)Calendar.DayTimeInterval / 2;

But obviously this is not a general fix.
I don't see why the localization is changing the outcome, since DateTime.Now already gives the local date and time.
I tried changing DateTime.Today to DateTime.Today.ToLocalTime(), which again puts the indicator right in the middle of the interval lines.

Maybe you can figure out more with this information.
If not I will leave it like that, because this page is not supposed to be used outside this timezone.

from heron.mudcalendar.

danheron avatar danheron commented on September 7, 2024

Where do you get this code from? The code in TimelinePosition() has never included Math.Floor().

The localization changes the output because some cultures use , as a decimal point and some cultures use .
The fix I applied was to use TimelinePosition().ToInvariantString() in the StyleBuilder() function.

from heron.mudcalendar.

APusch-Tenno avatar APusch-Tenno commented on September 7, 2024

Ah, sorry... I was experimenting with rounding the values, because I assumed it had to do with . vs. , as a decimal indicator, due to the whole localization issue.

I have inserted your fix, as stated before, which at least made the indicator move.

I meant so say:
I changed
var minutes = DateTime.Now.Subtract(DateTime.Today).TotalMinutes - (TimelineRow() * (int)Calendar.DayTimeInterval);
to
var minutes = DateTime.Now.Subtract(DateTime.Today).TotalMinutes - (TimelineRow() * (int)Calendar.DayTimeInterval) - (int)Calendar.DayTimeInterval / 2;

so subtracting half of the interval
This doesn't fix the origin of the problem, but for now does the job for me.

from heron.mudcalendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.