diff --git a/README.md b/README.md index 5f0d7c2..fb9a3ff 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Add the following lines to your `build.gradle` file: ```gradle dependencies { - implementation 'com.aminography:primecalendar:1.4.0' + implementation 'com.aminography:primecalendar:1.4.1' } ``` @@ -39,7 +39,7 @@ Add the following lines to your `pom.xml` file: com.aminography primecalendar - 1.4.0 + 1.4.1 ``` diff --git a/library/src/main/java/com/aminography/primecalendar/PrimeCalendar.kt b/library/src/main/java/com/aminography/primecalendar/PrimeCalendar.kt index e0f9e86..cc86199 100644 --- a/library/src/main/java/com/aminography/primecalendar/PrimeCalendar.kt +++ b/library/src/main/java/com/aminography/primecalendar/PrimeCalendar.kt @@ -521,25 +521,25 @@ abstract class PrimeCalendar( * Returns an instance of [CivilCalendar] which is equivalent to the time of the current calendar. */ fun toCivil(): CivilCalendar = - CivilCalendar().also { it.timeInMillis = timeInMillis } + CivilCalendar(internalCalendar.timeZone, locale).also { it.timeInMillis = timeInMillis } /** * Returns an instance of [PersianCalendar] which is equivalent to the time of the current calendar. */ fun toPersian(): PersianCalendar = - PersianCalendar().also { it.timeInMillis = timeInMillis } + PersianCalendar(internalCalendar.timeZone, locale).also { it.timeInMillis = timeInMillis } /** * Returns an instance of [HijriCalendar] which is equivalent to the time of the current calendar. */ fun toHijri(): HijriCalendar = - HijriCalendar().also { it.timeInMillis = timeInMillis } + HijriCalendar(internalCalendar.timeZone, locale).also { it.timeInMillis = timeInMillis } /** * Returns an instance of [JapaneseCalendar] which is equivalent to the time of the current calendar. */ fun toJapanese(): JapaneseCalendar = - JapaneseCalendar().also { it.timeInMillis = timeInMillis } + JapaneseCalendar(internalCalendar.timeZone, locale).also { it.timeInMillis = timeInMillis } // --------------------------------------------------------------------------------------------- @@ -854,7 +854,14 @@ abstract class PrimeCalendar( } } - private fun checkDisplayNameParams(field: Int, style: Int, minStyle: Int, maxStyle: Int, locale: Locale?, vararg fields: Int): Boolean { + private fun checkDisplayNameParams( + field: Int, + style: Int, + minStyle: Int, + maxStyle: Int, + locale: Locale?, + vararg fields: Int + ): Boolean { if (field < 0 || field >= FIELD_COUNT || style < minStyle || style > maxStyle) { throw IllegalArgumentException() }