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

How to set the min and max dates range to be largest as possible? #45

Closed
AndroidDeveloperLB opened this issue Oct 24, 2017 · 10 comments
Closed

Comments

@AndroidDeveloperLB
Copy link

Currently I use this:

    Calendar startDate = Calendar.getInstance();
    startDate.setTime(new Date(0L));
    Calendar endDate = Calendar.getInstance();
    endDate.add(Calendar.YEAR, 120);

    horizontalCalendar = new HorizontalCalendar.Builder(this, R.id.calendarView)
            .startDate(startDate.getTime())
            .endDate(endDate.getTime())
            ...

but what's the largest range this library support?

@muraee
Copy link
Owner

muraee commented Oct 24, 2017

Hello @AndroidDeveloperLB

The library doesn't specify any limits for the date range, as it is built on top of RecyclerView.
Unless RecyclerView has any limits, the only limit is how much your device can handle.

@muraee muraee closed this as completed Oct 24, 2017
@AndroidDeveloperLB
Copy link
Author

AndroidDeveloperLB commented Oct 24, 2017

How much is available then, by the framework?
I assume it's larger than what I wrote...

@muraee
Copy link
Owner

muraee commented Oct 24, 2017

It doesn't seem that RecyclerView has any limits, it depends only on the device capabilities.

@AndroidDeveloperLB
Copy link
Author

I didn't say the RecyclerView has limits. I asked about the dates themselves.
The RecyclerView does have limits BTW, by the adapter:

 int getItemCount()

so the max is Integer.MAX_VALUE-1 , which is a very large number.

@muraee
Copy link
Owner

muraee commented Oct 24, 2017

Dear @AndroidDeveloperLB

Integer.MAX_VALUE is no limit, it is simply the largest Integer out there, I was talking about real limits defined in the RecyclerView which there is not.
If you are asking about the dates limit, again it doesn't depends on the library, it is simply java Dates objects. so you need to check Java Docs for that.

@AndroidDeveloperLB
Copy link
Author

Can you please let me know what is the min&max limit?
If it's really 1970 for min, maybe it's better this library should use something else instead of Date? Maybe Calendar is better?

@muraee
Copy link
Owner

muraee commented Oct 24, 2017

1970-01-01 is the reference date used by java.util.Date, since java.util.Date stores dates as long (milliseconds) and long is a signed 64-bit integer, you can expect java.util.Date to cover about 290 million years before and after the reference date.

@AndroidDeveloperLB
Copy link
Author

So I can use before 1970?
Say, a 120 years before today, and 120 years after?

@muraee
Copy link
Owner

muraee commented Oct 24, 2017

Yes theoretically you can!

@AndroidDeveloperLB
Copy link
Author

ok sorry. Thought there are more strict limits.

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