Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-61343

JCalendarUtil.getWeekdayPosition() is locale-sensitive when it should not be

    Details

      Description

      JCalendarUtil.getWeekdayPosition() is locale-sensitive—i.e. it returns different values for different first days of week. It should not be that way. Indeed, we can get rid of this method and only use jCalendar.get(Calendar.DAY_OF_WEEK_IN_MONTH).

      Steps to reproduce

      1. Go into the directory modules/apps/calendar from the portal source code.
      2. Run ../../../gradlew -Duser.language=en -Duser.country=US test --tests com.liferay.calendar.util.JCalendarUtilTest.
      3. Run ../../../gradlew -Duser.language=pt -Duser.country=PT test --tests com.liferay.calendar.util.JCalendarUtilTest.

      Expected result

      • The tests would pass at steps 2 and 3.

      Actual result

      • The test fails at step 3:
      java.lang.AssertionError: expected:<1> but was:<2>
      	at org.junit.Assert.fail(Assert.java:88)
      	at org.junit.Assert.failNotEquals(Assert.java:834)
      	at org.junit.Assert.assertEquals(Assert.java:645)
      	at org.junit.Assert.assertEquals(Assert.java:631)
      	at com.liferay.calendar.util.JCalendarUtilTest.testGetWeekdayPosition2June2014(JCalendarUtilTest.java:114)
      ...
      

        Attachments

          Activity

            People

            Assignee:
            ian.song Ian Song (Inactive)
            Reporter:
            adam.brandizzi Adam Brandizzi
            Participants of an Issue:
            Recent user:
            Brian Wulbern
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              5 years, 23 weeks, 1 day ago

                Packages

                Version Package
                7.0.0 Beta 1