mirror of
https://github.com/tateisu/SubwayTooter
synced 2025-01-28 01:29:23 +01:00
account.last_status_atの解釈を変える
This commit is contained in:
parent
ae22bf3943
commit
29fa9c8007
@ -118,9 +118,9 @@ open class TootAccount(parser: TootParser, src: JsonObject) : HostAndDomain {
|
||||
var location: String? = null
|
||||
var birthday: String? = null
|
||||
|
||||
// mastodon 3.0.0-dev
|
||||
// last_status_at : "2019-08-29T12:42:08.838Z" or null
|
||||
private var last_status_at = 0L
|
||||
// mastodon 3.0.0-dev // last_status_at : "2019-08-29T12:42:08.838Z" or null
|
||||
// mastodon 3.1 // last_status_at : "2019-08-29" or null
|
||||
private var last_status_at =0L
|
||||
|
||||
// mastodon 3.3.0
|
||||
var suspended = false
|
||||
|
@ -1115,8 +1115,7 @@ class TootStatus(parser: TootParser, src: JsonObject) : TimelineItem() {
|
||||
|
||||
private val tz_utc = TimeZone.getTimeZone("UTC")
|
||||
|
||||
private val reDate = """\A(\d+)\D+(\d+)\D+(\d+)"""
|
||||
.asciiPattern()
|
||||
private val reDate = """\A\d+\D+\d+\D+\d+\z""".asciiPattern()
|
||||
|
||||
private val reTime = """\A(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)(?:\D+(\d+))?"""
|
||||
.asciiPattern()
|
||||
@ -1143,19 +1142,8 @@ class TootStatus(parser: TootParser, src: JsonObject) : TimelineItem() {
|
||||
}
|
||||
// last_status_at などでは YYYY-MM-DD になることがある
|
||||
m = reDate.matcher(strTime)
|
||||
if (m.find()) {
|
||||
val g = GregorianCalendar(tz_utc)
|
||||
g.set(
|
||||
m.groupEx(1).optInt() ?: 1,
|
||||
(m.groupEx(2).optInt() ?: 1) - 1,
|
||||
m.groupEx(3).optInt() ?: 1,
|
||||
12,
|
||||
34,
|
||||
56
|
||||
)
|
||||
g.set(Calendar.MILLISECOND, 789)
|
||||
return g.timeInMillis
|
||||
}
|
||||
if (m.find()) return parseTime("${strTime}T00:00:00.000Z")
|
||||
|
||||
log.w("invalid time format: %s", strTime)
|
||||
} catch (ex: Throwable) { // ParseException, ArrayIndexOutOfBoundsException
|
||||
log.trace(ex)
|
||||
|
Loading…
x
Reference in New Issue
Block a user