Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

时间显示问题 #7

Closed
lanzhu1993 opened this issue Oct 26, 2020 · 4 comments
Closed

时间显示问题 #7

lanzhu1993 opened this issue Oct 26, 2020 · 4 comments

Comments

@lanzhu1993
Copy link

在三星手机上选择时间,月份总是小一月,在华为手机上测试,月份显示正常

@lanzhu1993
Copy link
Author

`
private fun onDateTimeChanged() {

    if (mHourSpinner == null) mHour = 0
    if (mMinuteSpinner == null) mMinute = 0
    if (mSecondSpinner == null) mSecond = 0

    millisecond = if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
        LocalDateTime.of(mYear, mMonth -1, mDay, mHour, mMinute, mSecond)
            .toInstant(ZoneOffset.ofHours(8)).toEpochMilli()
    } else {
        val mCalendar = Calendar.getInstance()
        mCalendar.set(mYear, mMonth - 1, mDay, mHour, mMinute, mSecond)
        mCalendar.timeInMillis
    }


    if (mOnDateTimeChangedListener != null) {
        mOnDateTimeChangedListener?.invoke(millisecond)
    }
}

`
作者你好,你在赋值时已经把月份加1了,在赋值本地月份时间的时候需要减一

@loper7
Copy link
Owner

loper7 commented Oct 26, 2020

感谢发现问题,这个确实是疏忽了=.=

@lanzhu1993
Copy link
Author

感谢发现问题,这个确实是疏忽了=.=
作者你好,修复了,麻烦更新一下版本,谢谢

@loper7 loper7 closed this as completed in be46afc Nov 9, 2020
@loper7
Copy link
Owner

loper7 commented Nov 9, 2020

感谢发现问题,这个确实是疏忽了=.=
作者你好,修复了,麻烦更新一下版本,谢谢

0.2.1已处理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants