--- old/src/java.base/share/classes/java/time/chrono/HijrahDate.java 2016-10-07 13:51:56.000000000 +0530 +++ new/src/java.base/share/classes/java/time/chrono/HijrahDate.java 2016-10-07 13:51:56.000000000 +0530 @@ -368,7 +368,7 @@ if (field instanceof ChronoField) { switch ((ChronoField) field) { case DAY_OF_WEEK: return getDayOfWeek(); - case ALIGNED_DAY_OF_WEEK_IN_MONTH: return ((getDayOfWeek() - 1) % 7) + 1; + case ALIGNED_DAY_OF_WEEK_IN_MONTH: return ((dayOfMonth - 1) % 7) + 1; case ALIGNED_DAY_OF_WEEK_IN_YEAR: return ((getDayOfYear() - 1) % 7) + 1; case DAY_OF_MONTH: return this.dayOfMonth; case DAY_OF_YEAR: return this.getDayOfYear(); --- old/test/java/time/tck/java/time/chrono/TCKHijrahChronology.java 2016-10-07 13:51:57.000000000 +0530 +++ new/test/java/time/tck/java/time/chrono/TCKHijrahChronology.java 2016-10-07 13:51:57.000000000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -549,4 +549,32 @@ public void test_equals_false() { assertFalse(HijrahChronology.INSTANCE.equals(IsoChronology.INSTANCE)); } + + @DataProvider(name="alignedDayOfWeekInMonthTestDates") + Object[][] data_alignedDayOfWeekInMonth() { + return new Object[][] { + {1437, 9, 1}, //Monday is the 1st day of Month + {1437, 10, 1}, //Any Other day is the 1st day of month + {1437, 10, 11}, + {1437, 10, 29}, + }; + } + + //----------------------------------------------------------------------- + // Test for aligned-week-of-month calculation based on the day-of-month + //----------------------------------------------------------------------- + @Test(dataProvider="alignedDayOfWeekInMonthTestDates") + public void test_alignedWeekOfMonth(int year, int month, int dom) { + HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom); + assertEquals(date.getLong(ChronoField.ALIGNED_WEEK_OF_MONTH), ((dom - 1) / 7) + 1); + } + + //----------------------------------------------------------------------- + // Test for aligned-day-of-week calculation based on the day-of-month + //----------------------------------------------------------------------- + @Test(dataProvider="alignedDayOfWeekInMonthTestDates") + public void test_alignedDayOfWeekInMonth(int year, int month, int dom) { + HijrahDate date = HijrahChronology.INSTANCE.date(year, month, dom); + assertEquals(date.getLong(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), ((dom - 1) % 7) + 1); + } } --- old/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java 2016-10-07 13:51:58.000000000 +0530 +++ new/test/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java 2016-10-07 13:51:58.000000000 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -624,7 +624,7 @@ @Test public void test_chronoFields() { ChronoLocalDate hdate = HijrahChronology.INSTANCE.date(1434, 6, 28); - assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 3); + assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH), 7); assertEquals(hdate.get(ChronoField.ALIGNED_DAY_OF_WEEK_IN_YEAR), 7); assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_MONTH), 4); assertEquals(hdate.get(ChronoField.ALIGNED_WEEK_OF_YEAR), 25);