samanzamani / PersianDate

Persian date for android
BSD 3-Clause "New" or "Revised" License
330 stars 40 forks source link

PersianDate init exception #59

Closed mohammaddvlpr closed 2 years ago

mohammaddvlpr commented 3 years ago

Hi, I have an issue when initialize PersianDate object:

val date = PersianDate(date)

the date is in UTC Time Zone

here's the stack trace

ArrayIndexOutOfBoundsException length=13; index=-1

saman.zamani.persiandate.PersianDate in toJalali
saman.zamani.persiandate.PersianDate in prepareDate
saman.zamani.persiandate.PersianDate in setGrgDay
saman.zamani.persiandate.PersianDate in prepareDate2
saman.zamani.persiandate.PersianDate in setShYear
saman.zamani.persiandate.PersianDate in initGrgDate
saman.zamani.persiandate.PersianDate in changeTime
saman.zamani.persiandate.PersianDate in <init> at line 194

thanks for your support!

samanzamani commented 2 years ago

Hi @mohammaddvlpr Would you please add data variable data in your question so I can check?

mohammaddvlpr commented 2 years ago

hey, i just init PersianDate and nothing more.

val persianDate = PersianDate(date)

the date object is in UTC TimeZone

stack trace:

ArrayIndexOutOfBoundsException

length=13; index=-1
saman.zamani.persiandate.PersianDate in toJalali
saman.zamani.persiandate.PersianDate in prepareDate
saman.zamani.persiandate.PersianDate in setGrgDay
saman.zamani.persiandate.PersianDate in prepareDate2
saman.zamani.persiandate.PersianDate in setShYear
saman.zamani.persiandate.PersianDate in initGrgDate
saman.zamani.persiandate.PersianDate in changeTime
saman.zamani.persiandate.PersianDate in <init> at line 194
samanzamani commented 2 years ago

Update to v1.4.0