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

full year calendar #644

Closed
desb42 opened this issue Dec 31, 2019 · 3 comments
Closed

full year calendar #644

desb42 opened this issue Dec 31, 2019 · 3 comments

Comments

@desb42
Copy link
Collaborator

desb42 commented Dec 31, 2019

I have been investigating another Calendar issue (more of which in another issue), I came across this delight
yearcalendar
Note that February, April and June are not there but some other month

On investigation the wikitext

{{#time:F|2000-02}}

demonstrates the issue, returning

March

Further delving, I have found in 400_xowa\src\gplx\xowa\xtns\pfuncs\times\Pxd_parser.java what I suspect is the culprit.

At the moment, here, the date is 31th December 2019.
The current date is used to supply values that are missing when calculating a date, the wikitext is only supplying two values - year and month, xowa is supplying the day. This leads to, in this case, a date of 2000-02-31, which down in the depths of java converts to 2000-03-02 (as 2000 was a leap year), The F format is the full month hence March

Defaulting to the current day seems the correct approach - except in this case

More cumbersomebly, if ONLY a year is specified, month should be 1, day should be 1 (say?!)
and if ONLY a year and a month are specified, day should be 1

What do you think?

@desb42
Copy link
Collaborator Author

desb42 commented Dec 31, 2019

On further thought, I am currently going with some logic of the form

If setting a month value - check the day value and see if that day falls within the number of days for that month, if not set to the maximum for that month

This means I have needed to have a getter as well as a setter in 400_xowa\src\gplx\xowa\xtns\pfuncs\times\Pxd_date_bldr.java
That is, Seg_get(idx)

for most of the code changes see
Pxd_itm_int.zip

@gnosygnu gnosygnu added this to Triage in A <div> in D Dec 31, 2019
@gnosygnu
Copy link
Owner

gnosygnu commented Jan 2, 2020

Hi, sorry for lack of check-in on my side. I'm still working on #633. I should be finally finished in the next few days, and will reply to this issue and others as well. Thanks for filing the issue, and I will reply soon.

Also, happy new year!

@gnosygnu
Copy link
Owner

Wow! Incredible coincidence in discovery. (You needed to be viewing between the 29th and 31st day of a month).

Also, code change is completely spot on. Added with commit above.

Thanks!

@gnosygnu gnosygnu moved this from In progress to Done in A <div> in D Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
A <div> in D
  
Done
Development

No branches or pull requests

2 participants