Giter VIP home page Giter VIP logo

Comments (17)

tbee avatar tbee commented on July 30, 2024

Show me some code. :-)

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.US);
calendar.setTimeInMillis(DateTimeDialog.getInstance().getTimeToSet());
mCalendarPicker.setCalendar(calendar);

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

capture
capture2

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

thanks 4 help dude

from jfxtras.

tbee avatar tbee commented on July 30, 2024

You are setting a time in the calendar in the second line, no idea what value that is.

But, CalendarPicker is not doing anything with time zones, it uses merely a locale to get the day names right. It just renders the day, month, year, hour, minute, seconds that are in the calendar. Very curious what this line inserted before the setCalendar gives as a result:

System.out.println(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(calendar.getTime()));

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

as u can see in the photos above, the clock starts from 2 and ends to 1:59. That seems a bug to me since it must start from 0 and end to 23:59

from jfxtras.

tbee avatar tbee commented on July 30, 2024

ohhhh, I see!

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

It happens when i switch the calendar from default to UTC and set it to CalendarPicker.

from jfxtras.

tbee avatar tbee commented on July 30, 2024

Indeed. Interesting. I can reproduce it now.

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

so when i should expect a patch? :))

from jfxtras.

tbee avatar tbee commented on July 30, 2024

This is open source, so never :-) But I am looking into it now

from jfxtras.

tbee avatar tbee commented on July 30, 2024

So the cause is in calendar, but I have to think about why. If you execute this code:

	Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), Locale.US);
	System.out.println("H1=" + calendar.get(Calendar.HOUR_OF_DAY) + " / " + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(calendar.getTime()));
	Calendar calendar2 = Calendar.getInstance();
	System.out.println("H2=" + calendar2.get(Calendar.HOUR_OF_DAY) + " / " + new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").format(calendar2.getTime()));

I get this output (its just after noon here):

	H1=11 / 2018-12-28T12:14:45.468
	H2=12 / 2018-12-28T12:14:45.476

What you see if that they format into the same time (12 o'clock), but if you query for the 24-hour value, they differ.

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

that s strange indeed. I figured a workaround for me, i get the default time in millis then i extract the timezone raw offset, It works.

from jfxtras.

tbee avatar tbee commented on July 30, 2024

The formatter uses Date, which is not timezone aware, and thus always renders in the current timezone. The hour of day returns the value in the current timezone. Have to thing about how to solve this best, because date and time picking is done timezone unaware.

from jfxtras.

tbee avatar tbee commented on July 30, 2024

I think I have fixed it, but the release needs to pass all tests first. It is a fairly large change.

from jfxtras.

moctavianro avatar moctavianro commented on July 30, 2024

i see

from jfxtras.

tbee avatar tbee commented on July 30, 2024

I assume you're still using Java 8? Give 8-r7-SNAPSHOT a try please

from jfxtras.

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.