Wednesday, October 9, 2024

Re: java.time support

So web is not going to be worried, but... :) 
We have user interfaces for both thick (swing) and web using dates and now we need to use java.util.Date as this is supported by GWT.
Is there a way to use anything else than java.util.Date that is supported by GWT? 

Op wo 9 okt 2024 om 16:51 schreef Jens <jens.nehlmeier@gmail.com>:
Here is a link about the year 2038 problem: https://en.wikipedia.org/wiki/Year_2038_problem

Ah ok, thats where you are coming from.

JavaScript/ECMAScript defines that JavaScript Date supports exactly 100000000 days before and after unix epoch. This gives us a maximum year of 275760 that JavaScript Date can currently represent.

Java itself uses a long to represent millis since epoch in java.util.Date. Because long is 64 bit the maximum year that java.util.Date can represent is 292278994.

JavaScript: 275760
Java: 292278994

Since GWT emulates java.util.Date using native JavaScript Date the max year in GWT code is the one of JavaScript.

In any case year 2038 shouldn't be a problem, thats why I asked. You can easily verify it in browser console using

var millis = Date.parse("2040-06-01");
var date = new Date(millis);
console.log(date);

-- J. 

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/c195f5e8-1927-43a7-8796-634c56e20d84n%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/CABwrp8JX%3DcgKw6W50yd2%2BfubNGmoPMHaMT3K%3Dq3ZgVpU-WtVQA%40mail.gmail.com.

No comments:

Post a Comment