https://kotlinlang.org logo
Title
s

stanislav

02/25/2019, 10:12 AM
Hi guys, when using ktor's GMTDate, I'm getting this bug:
// 10:18:47 4.FEB.2019
// dateRaw: GMTDate = GMTDate(seconds=47, minutes=18, hours=10, dayOfWeek=MONDAY, dayOfMonth=4, dayOfYear=35, month=FEBRUARY, year=2019, timestamp=1549275527000)

val date = dateRaw.toJvmDate()
// date: Date (JVM/Android) — Mon Feb 25 13:07:27 GMT+03:00 2019 (CURRENT DATE)
e

e5l

02/25/2019, 10:13 AM
Hi @stanislav, thanks for the notice. Could you file an issue?
s

stanislav

02/25/2019, 10:14 AM
Yes, but I'm not sure it's an issue, because code provided is working correct.
/**
 * Convert to [Date]
 */
fun GMTDate.toJvmDate(): Date = Calendar.getInstance(GMT_TIMEZONE, Locale.ROOT)!!.time!!
So maybe it's more 'naming' issue, than real issue?
Is it supposed to convert given or current date to JVMDate?
:yes: 1
e

e5l

02/25/2019, 10:16 AM
but
dayOfMonth=4 <-> Mon Feb 25
looks ambiguous
s

stanislav

02/25/2019, 11:07 AM
Yeah, I'm talking about this, that .toJvmDate() converts NOT GIVEN DATE, but CURRENT (from calendar)
Sorry for late response.
e

e5l

02/28/2019, 7:33 AM
No problem 🙂 Thanks for the PR