Skip to content

Commit c8e9744

Browse files
jodastephensoc
authored andcommitted
Fixed Hijrah.getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH)
Update from PR See #47
1 parent 7575611 commit c8e9744

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

build.sbt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ lazy val pomData =
9393
<name>Carlos Quiroz</name>
9494
<url>https://github.com/cquiroz/</url>
9595
</contributor>
96+
<contributor>
97+
<name>Javier Fernandez-Ivern</name>
98+
<url>https://github.com/ivern</url>
99+
</contributor>
100+
<contributor>
101+
<name>Martin Baker</name>
102+
<url>https://github.com/kemokid</url>
103+
</contributor>
96104
<contributor>
97105
<name>Keith Harris</name>
98106
<url>https://github.com/keithharris</url>
@@ -120,8 +128,4 @@ lazy val pomData =
120128
<contributor>
121129
<name>Sherman Shen</name>
122130
</contributor>
123-
<contributor>
124-
<name>Javier Fernandez-Ivern</name>
125-
<url>https://github.com/ivern</url>
126-
</contributor>
127131
</contributors>

changes.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
Replace Java code with Scala code.
7070
</action>
7171
</release>
72+
<release version="1.3.3" date="SNAPSHOT" description="v1.3.3">
73+
<action dev="kemokid" type="fix" >
74+
Fix HijrahDate aligned-day-of-month field.
75+
Fixes #47.
76+
</action>
77+
</release>
7278
<release version="1.3.2" date="SNAPSHOT" description="v1.3.2">
7379
<action dev="jodastephen" type="fix" >
7480
Graceful fallback when printing time-zone name.

jvm/src/test/scala/org/threeten/bp/chrono/TestHijrahChronology.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import org.threeten.bp.LocalDateTime
4444
import org.threeten.bp.Month
4545
import org.threeten.bp.temporal.TemporalAdjusters
4646
import org.threeten.bp.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH
47+
import org.threeten.bp.temporal.ChronoField.ALIGNED_WEEK_OF_MONTH
4748

4849
/** Test. */
4950
@Test class TestHijrahChronology {
@@ -78,8 +79,14 @@ import org.threeten.bp.temporal.ChronoField.ALIGNED_DAY_OF_WEEK_IN_MONTH
7879

7980
@Test
8081
def test_alignedDayOfWeekInMonth(): Unit = {
81-
val date: HijrahDate = HijrahChronology.INSTANCE.date(1728, 10, 28);
82-
assertEquals(date.getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH), 7);
82+
var dom = 1
83+
while (dom <= 29) {
84+
var date: HijrahDate = HijrahChronology.INSTANCE.date(1728, 10, dom)
85+
assertEquals(date.getLong(ALIGNED_WEEK_OF_MONTH), ((dom - 1) / 7) + 1)
86+
assertEquals(date.getLong(ALIGNED_DAY_OF_WEEK_IN_MONTH), ((dom - 1) % 7) + 1)
87+
date = date.plusDays(1)
88+
dom += 1
89+
}
8390
}
8491

8592
@Test def test_adjust1(): Unit = {

0 commit comments

Comments
 (0)