Re: CalenderUtil Date Math BUG - GWT 2.8 RC2
As we are not calling a "set" operation but an "addMonthsToDate" operation and as a result we find this behavior surprising - and a little non-intuitive. Calendar does not "skip" a month when using "add" month, the days are adjusted to the end of the next month to prevent month "skipping". It does behave as described with a month "skip" if using "set" month instead. See also: http://stackoverflow.com/a/14618664/1341731 On 09/01/2016 09:20 AM, Paul Robinson wrote: git tells me CalendarUtil.java is the same in 2.7 and 2.8RC2. So yes, the code should behave the same. But the above behaviour is not wrong because it's standard Java behaviour. Whether you use Date.setMonth(n) or Calendar.set(Calendar.MONTH, n) Java behaves the same way. That is, if you start on August 31, and set the month to September, then you find you are on October 1. On Thu, Sep 1, 2016 at 10:01 AM, Daniel Kurkawrote: Does this code do the same thing in 2.7? On Wed, Aug 31, 2016 at 11:41 PM Paul Robinson wrote: You don't say what part of this you think is a bug. I presume it's the fact that Aug 31 plus one month is Oct 1. If so, this is not a bug. Adding one month should do literally that, so you get September 31. But there are only 30 days in September, so this automatically becomes October 1. Paul -- 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+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: CalenderUtil Date Math BUG - GWT 2.8 RC2
git tells me CalendarUtil.java is the same in 2.7 and 2.8RC2. So yes, the code should behave the same. But the above behaviour is not wrong because it's standard Java behaviour. Whether you use Date.setMonth(n) or Calendar.set(Calendar.MONTH, n) Java behaves the same way. That is, if you start on August 31, and set the month to September, then you find you are on October 1. On Thu, Sep 1, 2016 at 10:01 AM, Daniel Kurkawrote: > Does this code do the same thing in 2.7? > > On Wed, Aug 31, 2016 at 11:41 PM Paul Robinson wrote: > >> You don't say what part of this you think is a bug. I presume it's the >> fact that Aug 31 plus one month is Oct 1. If so, this is not a bug. >> >> Adding one month should do literally that, so you get September 31. But >> there are only 30 days in September, so this automatically becomes October >> 1. >> >> Paul >> >> -- >> 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+unsubscr...@googlegroups.com. >> To post to this group, send email to google-web-toolkit@googlegroups.com. >> Visit this group at https://groups.google.com/group/google-web-toolkit. >> For more options, visit https://groups.google.com/d/optout. >> > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to google-web-toolkit@googlegroups.com. > Visit this group at https://groups.google.com/group/google-web-toolkit. > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: CalenderUtil Date Math BUG - GWT 2.8 RC2
Does this code do the same thing in 2.7? On Wed, Aug 31, 2016 at 11:41 PM Paul Robinsonwrote: > You don't say what part of this you think is a bug. I presume it's the > fact that Aug 31 plus one month is Oct 1. If so, this is not a bug. > > Adding one month should do literally that, so you get September 31. But > there are only 30 days in September, so this automatically becomes October > 1. > > Paul > > -- > 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+unsubscr...@googlegroups.com. > To post to this group, send email to google-web-toolkit@googlegroups.com. > Visit this group at https://groups.google.com/group/google-web-toolkit. > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
Re: CalenderUtil Date Math BUG - GWT 2.8 RC2
You don't say what part of this you think is a bug. I presume it's the fact that Aug 31 plus one month is Oct 1. If so, this is not a bug. Adding one month should do literally that, so you get September 31. But there are only 30 days in September, so this automatically becomes October 1. Paul -- 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+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
CalenderUtil Date Math BUG - GWT 2.8 RC2
We have run into what looks like a date math bug for today's date: Here is our logged output: [butter] Wed Aug 31 16:15:15 GMT-400 2016 Tester Date: Wed Aug 31 16:15:15 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 mth: 8 [butter] Wed Aug 31 16:15:15 GMT-400 2016 mth: 7 [butter] Wed Aug 31 16:15:15 GMT-400 2016 q: 7 [butter] Wed Aug 31 16:15:15 GMT-400 2016 qMth: 7 [butter] Wed Aug 31 16:15:15 GMT-400 2016 qMth - mth: 1 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Date (now): Wed Aug 31 16:15:15 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Date (addMonthsToDate): Sat Oct 01 16:15:15 GMT-400 2016, 1 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Date:(setToFirstDayOfMonth) Sat Oct 01 00:00:00 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Date(addMonthsToDate+1): Tue Nov 01 00:00:00 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Date(addDaysToDate-1): Mon Oct 31 00:00:00 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 Tester setDateToLastOfQtr: Mon Oct 31 00:00:00 GMT-400 2016 [butter] Wed Aug 31 16:15:15 GMT-400 2016 - on butter module load - 2.8.0-rc2 Here is the code: public static void setDateToLastOfQtr(Date date) { // Magic Mike's Fist Qtr Fix --> ask him int mth = Integer.valueOf(DateTimeFormat.getFormat("M").format(date)); Api.log("mth: "+mth); mth--; Api.log("mth: "+mth); int q = mth / 3; Api.log("q: "+mth); int qMth = (q * 3) + 2; Api.log("qMth: "+mth); Api.log("qMth - mth: "+(qMth-mth)); Api.log("Date (now): "+date); CalendarUtil.addMonthsToDate(date, qMth - mth); Api.log("Date (addMonthsToDate): "+date+", "+(qMth-mth)); CalendarUtil.setToFirstDayOfMonth(date); Api.log("Date:(setToFirstDayOfMonth) "+date); CalendarUtil.addMonthsToDate(date, 1); Api.log("Date(addMonthsToDate+1): "+date); CalendarUtil.addDaysToDate(date, -1); Api.log("Date(addDaysToDate-1): "+date); } -- 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+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.