Giter Club home page Giter Club logo

Comments (55)

chanmratekoko avatar chanmratekoko commented on August 16, 2024 2

@chanmratekoko I think I figured out a solution: If I want to get the number of days for the last month I check the first day of the next year. For example, if next year starts 13 I know that my last month has only 12 days. Please let me know if it's a good approach maybe you have a better solution?

Another question is: I tested lots of dates and converting seems fine but I found one strange case: Converting 1952/2/1 https://yan9a.github.io/mcal/ returns 1313 Tabodwe 6 but your classes: 1313 Tabodwe 7 could you explain it?

Hello! @grzesiek2010
I apologize for the delayed response. The issue was resolved on the GitHub repository some time ago. Unfortunately, I couldn't update it on the Maven repository earlier due to the loss of my laptop. Now that I have access again, I will promptly update it. Thank you for your understanding.

from mmcalendar.

lognaturel avatar lognaturel commented on August 16, 2024 1

@chanmratekoko I also contribute to ODK Collect with @grzesiek2010 and can confirm that using 1.0.6.RC2 solves the desugaring problem. Thank you so much for all your help with this!

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko

Thanks for that explanations. Definitely, it's the most difficult calendar compared to those we already support but hopefully, we will be able to add this one too with your help.

If I use m2j() method I should use those indexes as I understand.

I created another test:

    private void convertingTest() {
        MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(1380, 1);
        List<Integer> monthIndexes = myanmarMonths.getIndex();

        for (Integer monthIndex : monthIndexes) {
            MyanmarDate myanmarDate = MyanmarDateKernel.j2m(MyanmarDateKernel.m2j(1380, monthIndex, 1));

            WesternDate westernDate = WesternDateConverter.convert(myanmarDate);

            Log.i("QWERTY", "MY: " + myanmarDate.getYearInt() + " MMI: " + monthIndex + " WY: " + westernDate.getYear() + " WMI: " + westernDate.getMonth());
        }
    }

Result:

MY: 1379 MMI: 2 WY: 2018 WMI: 4
MY: 1380 MMI: 3 WY: 2018 WMI: 5
MY: 1380 MMI: 0 WY: 2018 WMI: 6
MY: 1380 MMI: 4 WY: 2018 WMI: 7
MY: 1380 MMI: 5 WY: 2018 WMI: 8
MY: 1380 MMI: 6 WY: 2018 WMI: 9
MY: 1380 MMI: 7 WY: 2018 WMI: 10
MY: 1380 MMI: 8 WY: 2018 WMI: 11
MY: 1380 MMI: 9 WY: 2018 WMI: 12
MY: 1380 MMI: 10 WY: 2019 WMI: 1
MY: 1380 MMI: 11 WY: 2019 WMI: 2
MY: 1380 MMI: 12 WY: 2018 WMI: 6
MY: 1380 MMI: 13 WY: 2019 WMI: 4

Where:
MY - Myanmar year
MMI - Myanmar month index
WY - Wester year
WMI - Western month index

Doesn't looks good to me...

For the first index Myanmar year is still 1379.
and the penultimate row WY: 2018 where one before and one next is 2019, month also doesn't really match.

What am I doning wrong?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko
I will be testing it. I wanted to compare results with http://www.mmcalendar.com/ but there is just blank space. It's yours, right? Could yo fix it?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko

Sorry for my hundred questions but this calendar is so complex...
on the page you linked I can see eg for today:

1380 Nadaw Waning 13

Nadaw has 29 days so Waxing 13 means what? which day? How can I check it?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

But it's the same year so I don't understand the difference in the last row I attached:

MY: 1380 Month: 1 MMI: 13 MDI: 1 WY: 2019 WMI: 4 Day 5

myanmarDate.getMonth() returns 1 but monthIndex retruns 13....

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko
Thanks a lot for your help!
The pr on our side is ready: getodk/collect#2662
I asked you for testing so it to would be great if you can do that for us as well.
Of course, your repository will be mentioned in the list of open source project we use:
screenshot_2019-02-01-09-52-45

Let's keep this issue open until the pr is merged.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko I think I figured out a solution:
If I want to get the number of days for the last month I check the first day of the next year. For example, if next year starts 13 I know that my last month has only 12 days. Please let me know if it's a good approach maybe you have a better solution?

Another question is:
I tested lots of dates and converting seems fine but I found one strange case:
Converting 1952/2/1 https://yan9a.github.io/mcal/ returns 1313 Tabodwe 6
but your classes: 1313 Tabodwe 7
could you explain it?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

@chanmratekoko
I understand that you are busy because you didn't respond. Just wanted to let you know that the calendar based on your lib has been added to ODK Collect and a new version with that feature will be released soon getodk/collect#2662

The problem I pointed out above:

I tested lots of dates and converting seems fine but I found one strange case:
Converting 1952/2/1 https://yan9a.github.io/mcal/ returns 1313 Tabodwe 6
but your classes: 1313 Tabodwe 7
could you explain it?

is the only one. We would be very grateful if you could take a look at it in your free time.

Thanks!

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024 1

Thank you @chanmratekoko

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

You can use m2j method from MyanmarDateKernel class to convert from Myanmar date to Julian date.
or
You can also use convert method from WesternDateConverter class.

Hope it will help you.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko thanks I used:

MyanmarDate myanmarDate = MyanmarDate myanmarDate = getCurrentBurmeseDate()
WesternDateConverter.convert(MyanmarDateKernel.m2j(myanmarDate), CalendarType.GREGORIAN)

and looks as if it's ok but I want to construct the MyanmarDate object using values: year, month, day. Is it possible I can't see such an option?
For example, I have MyanmarDate year: 1380 MyanmarDate month: 9, MyanmarDate day: 20 and I need to get a MyanmarDate object.

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010
You need at least four parameters.
For Tagu and Kason, you must explicitly mention whether Oo or Hnaung, mmt=0 or 1.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko

do you mean this constructor https://github.com/chanmratekoko/mmcalendar/blob/master/src/main/java/mmcalendar/MyanmarDate.java#L109?

I don't really get it could you provide an example let's say my Myanmar date is 1380 Tawthalin waning 12. How can I convert it to Gregorian date?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

public static double m2j(double myear, double mmonth, double monthType, double moonPhase, double fortnightDay) {

This one!

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko thanks for you help but I'm a little bit confused...

My use case is:

  1. Convert Gregorian date to Myanmar (which is easy)
  2. Build a custom calendar like
    zozu4

I prepare spinners using getters:
getMonthDay()
getMonth()
getYearInt()
Let's say initial values are:
year: 1380 month: 7 day: 2

  1. Then users might change those values. Let's assume after changing them we have:
    year: 1381 month: 6 day: 5

  2. I need to get Myanmar object using those new values in order to convert it to Gregorian date back.

I don't have those double monthType, double moonPhase, double fortnightDay is it possible?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko any chance to solve my problem?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

You can use this method.

Here is a test link.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko

Thanks a lot! Could you prepare a new release (I use gradle dependency)?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

v1.0.5.RELEASE Out

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko

Thanks, but there is one problem: my build fails every time I use v1.0.5.RELEASE, everything is fine with v1.0.4.RELEASE... Did you change anything else what might cause the problem?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko

I got this:

Exception in thread "main" java.lang.IllegalArgumentException: Type without superclass: module-info
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191)
	at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visit(DefaultMethodClassFixer.java:80)
	at org.objectweb.asm.ClassVisitor.visit(ClassVisitor.java:113)
	at com.google.devtools.build.android.desugar.InterfaceDesugaring.visit(InterfaceDesugaring.java:97)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
	at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
	at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
	at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
	at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
	at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)

If I just change v1.0.5.RELEASE to v1.0.4.RELEASE everything is fine.
I saw this https://stackoverflow.com/questions/52589914/android-type-without-superclass-module-info but no avail.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko any idea what could be wrong with the newest release?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Hum, I just added one method for you in this version. Let me have a look.

Could you please test with this version.

implementation group: 'com.github.chanmratekoko', name: 'myanmar-calendar', version: '1.0.6.RC2'

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010 @lognaturel

You are welcome, I think this code help your requirement,
You can use,

   double  julianDay = MyanmarDateKernel.m2j(1380 , 7 , 14); 
    WesternDate westernDate = WesternDateKernel.j2w(julianDay, CalendarType.ENGLISH);
    Calendar cal = Calendar.getInstance();
    cal.clear();

    cal.set(Calendar.YEAR, westernDate.getYear());
    cal.set(Calendar.MONTH, westernDate.getMonth() - 1);
    cal.set(Calendar.DATE, westernDate.getDay());
    cal.set(Calendar.HOUR, westernDate.getHour());
    cal.set(Calendar.MINUTE, westernDate.getMinute());
    cal.set(Calendar.SECOND, westernDate.getSecond());

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Hi again @chanmratekoko

I tried to build the mentioned calendar for ODK Collect using the latest release but I have found something strange. Please take a look.

I'm trying to create a MyanmarDate object using the m2j() method you have added.
Sample:

MyanmarDate myanmarDate1 = MyanmarDateKernel.j2m(MyanmarDateKernel.m2j(1380, 1, 1));

but when I debug the code I got the year 1379:

screenshot from 2018-10-30 14-57-05

The same with month 2

MyanmarDate myanmarDate1 = MyanmarDateKernel.j2m(MyanmarDateKernel.m2j(1380, 2, 1));

and next months probbaly look fine.
I guess there is something wrong with the implementation?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

For Myanmar year 1380 start from month 2. Have a look.

MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(1380, 1);
myanmarMonth.getMonthNameList();
myanmarMonth.getIndex();

[Kason, Nayon, First Waso, Second Waso, Wagaung, Tawthalin, Thadingyut, Tazaungmon, Nadaw, Pyatho, Tabodwe, Tabaung, Late Tagu]
[2, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

You should not reference this calendar.

http://www.mmcalendar.com/index.php?typeMonth=m&&setDay=1380-2-1&&change=-1

It is not correct in the exact calendar.

from mmcalendar.

lognaturel avatar lognaturel commented on August 16, 2024

For Myanmar year 1380 start from month 2. Have a look.

Wow, this is a really interesting calendar!! Thanks for helping us understand it.

It is not correct in the exact calendar.

I thought that was your calendar backed by this library but was I wrong?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@lognaturel

We referenced from that.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko what about

and the penultimate row WY: 2018 where one before and one next is 2019, month also doesn't really match.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Hi, @chanmratekoko I was on vacation but now I'm back and I would like to know whether you were able to figure out what's wrong?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko have you seen my question?

from mmcalendar.

aurdipas avatar aurdipas commented on August 16, 2024

Dear @chanmratekoko I'm collaborating at the D4H initiative in Myanmar https://crvsgateway.info/file/4139/140 and I was the requester of the availability of the Myanmar calendar in ODK. It would be great if we get this available to use it in your country.

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@aurdipas

Yes, You can use under the MIT License.

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Sorry for late reply, I am on vacation now. I will fix that bug soon.

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

Hi @grzesiek2010

You can use with this version.

<dependency>
  <groupId>com.github.chanmratekoko</groupId>
  <artifactId>myanmar-calendar</artifactId>
  <version>1.0.6.RC3</version>
</dependency>

And also you can test with this code.

        int mmYear = 1358;

        String[] ema = { "First Waso", "Tagu", "Kason", "Nayon", "Waso", "Wagaung", "Tawthalin", "Thadingyut",
                "Tazaungmon", "Nadaw", "Pyatho", "Tabodwe", "Tabaung", "Late Tagu", "Late Kason" };

        MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(mmYear, 1);
        List<Integer> monthIndexes = myanmarMonths.getIndex();

        for (int index = 0; index < monthIndexes.size(); index++) {
            Integer monthIndex = monthIndexes.get(index);
            double julianDate = 0;
            if (index == 0) {
                Thingyan thingyan = ThingyanCalculator.getThingyan(mmYear);
                double newYearDay = thingyan.getMyanmarNewYearDay(); // Myanmar new year day
                julianDate = newYearDay;
            } else {
                julianDate = MyanmarDateKernel.m2j(mmYear, monthIndex, 1);
            }

            MyanmarDate myanmarDate = MyanmarDateKernel.j2m(julianDate);
            WesternDate westernDate = WesternDateConverter.convert(myanmarDate);

            System.out.println(" MY: " + myanmarDate.getYearInt() + " MMI: " + monthIndex + " WY: "
                    + westernDate.getYear() + " WMI: " + westernDate.getMonth() + " Day " + westernDate.getDay());
        }

Hopefully, It can help you.

If you have any questions, please feel free to ask me.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko
Thanks for your help.
I tested two years:
1350 and the result looks fine:

MY: 1350 MMI: 2 WY: 1988 WMI: 4
MY: 1350 MMI: 3 WY: 1988 WMI: 5
MY: 1350 MMI: 0 WY: 1988 WMI: 4
MY: 1350 MMI: 4 WY: 1988 WMI: 7
MY: 1350 MMI: 5 WY: 1988 WMI: 8
MY: 1350 MMI: 6 WY: 1988 WMI: 9
MY: 1350 MMI: 7 WY: 1988 WMI: 10
MY: 1350 MMI: 8 WY: 1988 WMI: 11
MY: 1350 MMI: 9 WY: 1988 WMI: 12
MY: 1350 MMI: 10 WY: 1989 WMI: 1
MY: 1350 MMI: 11 WY: 1989 WMI: 2
MY: 1350 MMI: 12 WY: 1989 WMI: 3
MY: 1350 MMI: 13 WY: 1989 WMI: 4

and second was 1358 and here something is wrong (first line):

MY: 1357 MMI: 1 WY: 1996 WMI: 3
MY: 1358 MMI: 2 WY: 1996 WMI: 4
MY: 1358 MMI: 3 WY: 1996 WMI: 5
MY: 1358 MMI: 0 WY: 1996 WMI: 4
MY: 1358 MMI: 4 WY: 1996 WMI: 7
MY: 1358 MMI: 5 WY: 1996 WMI: 8
MY: 1358 MMI: 6 WY: 1996 WMI: 9
MY: 1358 MMI: 7 WY: 1996 WMI: 10
MY: 1358 MMI: 8 WY: 1996 WMI: 11
MY: 1358 MMI: 9 WY: 1996 WMI: 12
MY: 1358 MMI: 10 WY: 1997 WMI: 1
MY: 1358 MMI: 11 WY: 1997 WMI: 2
MY: 1358 MMI: 12 WY: 1997 WMI: 3
MY: 1358 MMI: 13 WY: 1997 WMI: 4

could you explain it?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Could you please test with this code below.

1.0.6.RC3

        int mmYear = 1358;

        String[] ema = { "First Waso", "Tagu", "Kason", "Nayon", "Waso", "Wagaung", "Tawthalin", "Thadingyut",
                "Tazaungmon", "Nadaw", "Pyatho", "Tabodwe", "Tabaung", "Late Tagu", "Late Kason" };

        MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(mmYear, 1);
        List<Integer> monthIndexes = myanmarMonths.getIndex();

        for (int index = 0; index < monthIndexes.size(); index++) {
            Integer monthIndex = monthIndexes.get(index);
            double julianDate = 0;
            if (index == 0) {
                Thingyan thingyan = ThingyanCalculator.getThingyan(mmYear);
                double newYearDay = thingyan.getMyanmarNewYearDay(); // Myanmar new year day
                julianDate = newYearDay;
            } else {
                julianDate = MyanmarDateKernel.m2j(mmYear, monthIndex, 1);
            }

            MyanmarDate myanmarDate = MyanmarDateKernel.j2m(julianDate);
            WesternDate westernDate = WesternDateConverter.convert(myanmarDate);

            System.out.println(" MY: " + myanmarDate.getYearInt() + " MMI: " + monthIndex + " WY: "
                    + westernDate.getYear() + " WMI: " + westernDate.getMonth() + " Day " + westernDate.getDay());
        }
 MY: 1350 MMI: 2 WY: 1988 WMI: 4 Day 16
 MY: 1350 MMI: 3 WY: 1988 WMI: 5 Day 16
 MY: 1350 MMI: 0 WY: 1988 WMI: 6 Day 14
 MY: 1350 MMI: 4 WY: 1988 WMI: 7 Day 14
 MY: 1350 MMI: 5 WY: 1988 WMI: 8 Day 13
 MY: 1350 MMI: 6 WY: 1988 WMI: 9 Day 11
 MY: 1350 MMI: 7 WY: 1988 WMI: 10 Day 11
 MY: 1350 MMI: 8 WY: 1988 WMI: 11 Day 9
 MY: 1350 MMI: 9 WY: 1988 WMI: 12 Day 9
 MY: 1350 MMI: 10 WY: 1989 WMI: 1 Day 7
 MY: 1350 MMI: 11 WY: 1989 WMI: 2 Day 6
 MY: 1350 MMI: 12 WY: 1989 WMI: 3 Day 7
 MY: 1350 MMI: 13 WY: 1989 WMI: 4 Day 6
 MY: 1358 MMI: 1 WY: 1996 WMI: 4 Day 16
 MY: 1358 MMI: 2 WY: 1996 WMI: 4 Day 17
 MY: 1358 MMI: 3 WY: 1996 WMI: 5 Day 17
 MY: 1358 MMI: 0 WY: 1996 WMI: 6 Day 16
 MY: 1358 MMI: 4 WY: 1996 WMI: 7 Day 16
 MY: 1358 MMI: 5 WY: 1996 WMI: 8 Day 15
 MY: 1358 MMI: 6 WY: 1996 WMI: 9 Day 13
 MY: 1358 MMI: 7 WY: 1996 WMI: 10 Day 13
 MY: 1358 MMI: 8 WY: 1996 WMI: 11 Day 11
 MY: 1358 MMI: 9 WY: 1996 WMI: 12 Day 11
 MY: 1358 MMI: 10 WY: 1997 WMI: 1 Day 9
 MY: 1358 MMI: 11 WY: 1997 WMI: 2 Day 8
 MY: 1358 MMI: 12 WY: 1997 WMI: 3 Day 9
 MY: 1358 MMI: 13 WY: 1997 WMI: 4 Day 8

Exception

  1. For Gregorian Calendar, there is 12 month in a year.
    For Myanmar Calendar, there is 12 month for some year and some have 13 or 14. (like Late Tagu, Lake Kason and also have First Waso, Second Waso )
  1. For Gregorian Calendar, the new year is 1st of January.
    For Myanmar Calendar, there is not constant months name and day. New year date starts and based on the solar year. (Therefore, we need to find a new year day for the first month.)
    If you want to know more details, please read this document.
    http://cool-emerald.blogspot.com/2013/06/algorithm-program-and-calculation-of.html#myear

The length of a solar year in the Myanmar calendar is defined as 1577917828/4320000 (365.2587565)
The beginning of a year is obtained by adding that constant to the beginning of the previous year.
Starting time of a few recent Myanmar years can be found in recently published calendars.
The Myanmar new year festival (the water festival) is called the Thingyan. A typical Myanmar calendar mentions the beginning of the year called the atat time and it is the end of the Thingyan. The starting time of the Thingyan is called the akya time. The length of the Thingyan currently recognized by Myanmar Calendar Advisory Board is 2.169918982 days ( 2days, 4 hours, 4 minutes and 41 seconds). When the time of ancient Myanmar kings, 2.1675 days (2 days, 4 hours, 1 min and 12 seconds) was used as the length of the Thingyan. Therefore, the akya time can be obtained by subtracting 2.169918982 days from the atat time.

#1 (comment)

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@chanmratekoko
I will be testing it. I wanted to compare results with http://www.mmcalendar.com/ but there is just blank space. It's yours, right? Could yo fix it?

@grzesiek2010
You can test with this site.
I recommended this one.
https://yan9a.github.io/mcal/

It is not mine. (http://www.mmcalendar.com/)

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Yes, I agree, Myanmar calendar is so complex to understand.

1380 Nadaw Waning 13
Above the Myanmar calendar format can print with code like this.

        Config.initDefault(
                new Config.Builder().setCalendarType(CalendarType.ENGLISH).setLanguage(Language.ENGLISH).build());
        
        MyanmarDate myanmarDate = MyanmarDateConverter.convert(2019, 1, 4);
        System.out.println(myanmarDate.format("y M p f")); 
        //OR
        System.out.println(myanmarDate.getYear() + " " + myanmarDate.getMonthName() + " "+
                myanmarDate.getMoonPhase() + " " + myanmarDate.getFortnightDayInt());

You can read Documentation, Please Read 7.2
http://cool-emerald.blogspot.com/2013/06/algorithm-program-and-calculation-of.html#mnd

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Hi again @chanmratekoko

as I said I was testing 1.0.6.RC3.

Something was not clear so I prepared this small test:

I get months for Myanmar year 1381:
screenshot from 2019-01-06 22-55-26

the first month has index 1 so then I convert Myanmar date to Julian

and the last step is converting Julian to Myanmar;

 MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(1381, 1);

double julianDate = MyanmarDateKernel.m2j(1381, 1, 1);
MyanmarDate myanmarDate = MyanmarDateKernel.j2m(julianDate);

The result is year 1380... why? Is it a bug or maybe I'm doing something wrong?

screenshot from 2019-01-06 22-55-46

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Could you please share your test code?
Then, please read this.

#1 (comment)

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Could you please share your test code?

I shared.

Those three lines in my last comment and that's all:

MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(1381, 1);

double julianDate = MyanmarDateKernel.m2j(1381, 1, 1);
MyanmarDate myanmarDate = MyanmarDateKernel.j2m(julianDate);

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Did you read this?

Exception

  1. For Gregorian Calendar, there is 12 month in a year.
    For Myanmar Calendar, there is 12 month for some year and some have 13 or 14. (like Late Tagu, Lake Kason and also have First Waso, Second Waso )
  1. For Gregorian Calendar, the new year is 1st of January.
    For Myanmar Calendar, there is not constant months name and day. New year date starts and based on the solar year. (Therefore, we need to find a new year day for the first month.)
    If you want to know more details, please read this document.
    http://cool-emerald.blogspot.com/2013/06/algorithm-program-and-calculation-of.html#myear

The length of a solar year in the Myanmar calendar is defined as 1577917828/4320000 (365.2587565)
The beginning of a year is obtained by adding that constant to the beginning of the previous year.
Starting time of a few recent Myanmar years can be found in recently published calendars.
The Myanmar new year festival (the water festival) is called the Thingyan. A typical Myanmar calendar mentions the beginning of the year called the atat time and it is the end of the Thingyan. The starting time of the Thingyan is called the akya time. The length of the Thingyan currently recognized by Myanmar Calendar Advisory Board is 2.169918982 days ( 2days, 4 hours, 4 minutes and 41 seconds). When the time of ancient Myanmar kings, 2.1675 days (2 days, 4 hours, 1 min and 12 seconds) was used as the length of the Thingyan. Therefore, the akya time can be obtained by subtracting 2.169918982 days from the atat time.

#1 (comment)

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Yes and I still don't understand...
As I said above I received a list of months for 1381:

MyanmarMonths myanmarMonths = MyanmarDateKernel.getMyanmarMonth(1381, 1);

and looked into indexes:
1,2,3,4,5,6,7,8,9,10,11,12,13

a month with index 1 exists in year 1381 so I tried to convert that date to julian:

double julianDate = MyanmarDateKernel.m2j(1381, 1, 1);

and expected that after converting back julian->myanmar it will be still the same date
but as I mentioned year is 1380 not 1381.

MyanmarDate myanmarDate = MyanmarDateKernel.j2m(julianDate);

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

For Gregorian Calendar, there is 12 month in a year.
For Myanmar Calendar, there is 12 month for some year and some have 13 or 14. (like Late Tagu, Lake Kason and also have First Waso, Second Waso )

so

double julianDate = MyanmarDateKernel.m2j(1381, 1, 1);
will throw expection. because it included in 1380

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Why does it include in 1380?
If I receive a list of months for 1381

MyanmarDateKernel.getMyanmarMonth(1381, 1);

I expected all months are in 1381...
is it because only a part of that first month belongs to 1381 but day 1 I used belongs to 1380?

double julianDate = MyanmarDateKernel.m2j(1381, 1, 1);

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Sorry for my explanation, It makes you misunderstanding.

For Gregorian Calendar, the new year is 1st of January. (New year start from January 1st)

For Myanmar Calendar, there is not constant months name and day. New year date starts and based on the solar year. (Therefore, we need to find a new year day for the first month.)

Myanmar year is not start from 1 month and 1st day. Some of the year starting 12, or ....
So, Assumption, the 1st month has 30 days. 1 to 30,
Let 1381 (For 1381 new year day starts from 1 st month of 13)
1 st month of 1 to 12 belongs to 1380.
if new year day is 1 month of 13.
13 to 30 belongs to 1381.
(It is complex.) So, We need to find start day of the year called (Thingyan) like this

                Thingyan thingyan = ThingyanCalculator.getThingyan(mmYear);
                double newYearDay = thingyan.getMyanmarNewYearDay(); // Myanmar new year day

If you want to know more details, please read this document.
http://cool-emerald.blogspot.com/2013/06/algorithm-program-and-calculation-of.html#myear

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko
Thanks, now I understand so far at least 😄

I used the test you provided above #1 (comment)
just edited the log to display more values:

System.out.println(" MY: " + myanmarDate.getYearInt() + " Month: " + myanmarDate.getMonth() + " MMI: " + monthIndex + " WY: "
                    + westernDate.getYear() + " WMI: " + westernDate.getMonth() + " Day " + westernDate.getDay());
MY: 1380 Month: 2 MMI: 2 MDI: 3 WY: 2018 WMI: 4 Day 17
MY: 1380 Month: 3 MMI: 3 MDI: 1 WY: 2018 WMI: 5 Day 15
MY: 1380 Month: 0 MMI: 0 MDI: 1 WY: 2018 WMI: 6 Day 13
MY: 1380 Month: 4 MMI: 4 MDI: 1 WY: 2018 WMI: 7 Day 13
MY: 1380 Month: 5 MMI: 5 MDI: 1 WY: 2018 WMI: 8 Day 12
MY: 1380 Month: 6 MMI: 6 MDI: 1 WY: 2018 WMI: 9 Day 10
MY: 1380 Month: 7 MMI: 7 MDI: 1 WY: 2018 WMI: 10 Day 10
MY: 1380 Month: 8 MMI: 8 MDI: 1 WY: 2018 WMI: 11 Day 8
MY: 1380 Month: 9 MMI: 9 MDI: 1 WY: 2018 WMI: 12 Day 8
MY: 1380 Month: 10 MMI: 10 MDI: 1 WY: 2019 WMI: 1 Day 6
MY: 1380 Month: 11 MMI: 11 MDI: 1 WY: 2019 WMI: 2 Day 5
MY: 1380 Month: 12 MMI: 12 MDI: 1 WY: 2019 WMI: 3 Day 6
MY: 1380 Month: 1 MMI: 13 MDI: 1 WY: 2019 WMI: 4 Day 5

could you explain to me why Month (which is myanmarDate.getMonth()) differs from MMI (which is an index received from MyanmarDateKernel.getMyanmarMonth(mmYear, 1).getIndex())? It's different just in the last month.

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko
Have you seen my question?

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

Some of the Myanmar new year (for a month) start from month 2. So, for month 1 move to last
and name change (Tagu to late Tagu.)

from mmcalendar.

chanmratekoko avatar chanmratekoko commented on August 16, 2024

@grzesiek2010

myanmarDate.getMonth() returns 1
Mean Tagu

monthIndex returns 13
Mean Late Tagu

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

Hi again @chanmratekoko

Looks as if I made a mistake creating days spinner...
I assumed that I can just use:
minValue - calculate the first month day (as you explained above)
maxValue - myanmarDate.getMonthLength()

but it won't work for the last month where only some days belong to the same year and some are in next year.
So my question is: Is it possible to calculate last year day?

I tried counting all days in a year and for example for year 1381 it's:

MyanmayMonthName: တန်ခူး MonthFirstDay: 13 MonthLength: 29 DaysInYear: 17
MyanmayMonthName: ကဆုန် MonthFirstDay: 1 MonthLength: 30 DaysInYear: 47
MyanmayMonthName: နယုန် MonthFirstDay: 1 MonthLength: 29 DaysInYear: 76
MyanmayMonthName: ဝါဆို MonthFirstDay: 1 MonthLength: 30 DaysInYear: 106
MyanmayMonthName: ဝါခေါင် MonthFirstDay: 1 MonthLength: 29 DaysInYear: 135
MyanmayMonthName: တော်သလင်း MonthFirstDay: 1 MonthLength: 30 DaysInYear: 165
MyanmayMonthName: သီတင်းကျွတ် MonthFirstDay: 1 MonthLength: 29 DaysInYear: 194
MyanmayMonthName: တန်ဆောင်မုန်း MonthFirstDay: 1 MonthLength: 30 DaysInYear: 224
MyanmayMonthName: နတ်တော် MonthFirstDay: 1 MonthLength: 29 DaysInYear: 253
MyanmayMonthName: ပြာသို MonthFirstDay: 1 MonthLength: 30 DaysInYear: 283
MyanmayMonthName: တပို့တွဲ MonthFirstDay: 1 MonthLength: 29 DaysInYear: 312
MyanmayMonthName: တပေါင်း MonthFirstDay: 1 MonthLength: 30 DaysInYear: 342
MyanmayMonthName: နှောင်းတန်ခူး MonthFirstDay: 1 MonthLength: 29 DaysInYear: 371

YearLength: 354

YearLength is a value returned from myanmarDate.getYearLength()
DaysInYear = 371
YearLength = 354

DaysInYear - YearLength = 17
LastMonthLength = 29
29 - 17 = 12 <-- that indicates 12 is the last day of the year

but creating myanmar dates manually day by day I discovered that last day in 1381 is 24...

MyanmarDateUtils.createMyanmarDate(1381,13,24);
returns year 1381
but
MyanmarDateUtils.createMyanmarDate(1381,13,25);
returns year 1382

Could you help with this issue?

from mmcalendar.

grzesiek2010 avatar grzesiek2010 commented on August 16, 2024

@chanmratekoko is there any chance you will answer my questions sooner or later? It would be great. Thanks!

from mmcalendar.

Related Issues (2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.