Add appearance bikram-sambat similar to ethiopian (#1505).
The goal is for the widget to look like other calendar widgets and to use standard Android components as much as possible. Ideally this will involve creating a new Joda chronology just like for the EthiopicChronology.
Medic mobile have developed a library for this at https://github.com/medic/bikram-sambat. Once it's licensed, it could be used with modifications to make it not conflict with question labels and to have some basic validation. Perhaps the could be collaboration to get the core logic into a Joda chronology.
@lognaturel
It would be really great to us here in Nepal
Awesome to hear this would be useful to you, @lokpriya! Would you be willing to help us with some verification once the feature is ready?
Let's see how best to proceed. @alxndrsn did you have plans to look at the joda implementation any time soon? Or @grzesiek2010, do you have a sense of how long it might take you?
@nishontan I saw you were interested in working on the Ethiopian calendar implementation. It looks like you're also from Nepal so perhaps you'd also be interested in this one!
@lognaturel Yes ! I am interested
@nishontan great! Let me know if I can help in any way.
@alxndrsn
Bikram Sambat Input : 2074-07-31 (YYYY-MM-DD)
Expected Gregorian Output: None, Input was invalid date.
Gregorian output: 2017-11-17
@nishontan I think Gregorian 2017-11-17 should be Bikram Sambat 2074-08-1, and there are 30 days in the 7th month of 2074. When an incorrect number of days is supplied, the date rolls over. This is similar to behaviour in the standard Calendar and Date libraries of Java and Javascript respectively:
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class MyDate {
public static void main(String... args) {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2017);
cal.set(Calendar.MONTH, 1); // zero-indexed - 1=February
cal.set(Calendar.DAY_OF_MONTH, 31);
System.out.println("Date: " + new SimpleDateFormat("yyyy/MM/dd").format(cal.getTime()));
}
}
->
Date: 2017/03/03
> new Date('2017-02-31')
2017-03-03T00:00:00.000Z
Ideally the pickers used would be the same pickers as for the Gegorian calendar and the Ethiopian calendar and only valid dates would be allowed. Does that sound right?
Ideally the pickers used would be the same pickers as for the Gegorian calendar and the Ethiopian calendar and only valid dates would be allowed. Does that sound right?
That sounds fine, but I don't think it's directly related to the discussion above. IIUC we would be able to plug directly into the android pickers once we've implemented a JodaTime chronology.
馃憤 So to be clear @nishontan, the first step will be to create a joda Chronology with tests like the ones in https://github.com/JodaOrg/joda-time/tree/909046aa9aab5fae75e2152fd6ded722a4d5aba2/src/main/java/org/joda/time/chrono
Once that is ready, #1576 is a good model of how to add a new calendar type to Collect.
nobody thinking also to add Burmese calendar? https://en.wikipedia.org/wiki/Burmese_calendar
@aurdipas If you have a need for the Burmese calendar, please post in features on the forum!
@grzesiek2010 has created a pull request at https://github.com/JodaOrg/joda-time/pull/479. It may eventually get merged but then joda-time would need to be updated in joda-android and all of that will certainly take time. I think we should start by adding the chronology in Collect. Since no internal library access is needed in the chronology implementation, it can exist in here for now and can be removed if ever the libraries do support it.
Unfortunately, @bishwash72's code that @grzesiek2010 worked from is unlicensed. @bishwash72, I see that you have an Apache license header at https://github.com/bishwash72/joda-time-BIS/blob/c66e659e3bcd32c357b747550b535ff296974726/src/main/java/org/joda/time/chrono/BISChronology.java but no license for BISTest or BISDateTimeField. Would you consider adding license headers with you as the copyright holder to those files?
Let's give @bishwash72 a few days to answer. If we don't hear anything, unfortunately we can't use that code directly. So @grzesiek2010, you'd need to build a fresh implementation with what you've learned but without directly looking at the unlicensed code.
@lognaturel @grzesiek2010 you can freely use my code and I have no concerns related to it. I can add same license code on BISTest and BISDateTimeField.
Thanks so much for the response and for making this code available, @bishwash72! It would be great if you could add the headers. Please do put your name as the copyright holder since it's your code. 馃槉
@lognaturel I have added header with copyright info and my name. I have created the pull request. https://github.com/grzesiek2010/joda-time/pull/1
Turns out that joda time has stopped active development (since this issue was filed, I believe)! So submitting a PR there doesn't make sense. The author believes that it should be possible to define a chronology without needing access to private methods and has offered to help if there are issues with that -- https://github.com/JodaOrg/joda-time/pull/479#issuecomment-424880103.
The last resort is to use something completely outside of the time libs.
Closed in #2620