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

Add CBA_fnc_weekDay #1533

Merged
merged 2 commits into from
Mar 6, 2022
Merged

Add CBA_fnc_weekDay #1533

merged 2 commits into from
Mar 6, 2022

Conversation

jonpas
Copy link
Member

@jonpas jonpas commented Feb 16, 2022

When merged this pull request will:

  • Add a function that calculates date's day of the week using a modified Rata Die method with fractional years.
  • Add unit tests for the function.

@jonpas jonpas added the Feature label Feb 16, 2022
@commy2
Copy link
Contributor

commy2 commented Feb 16, 2022

CBA_fnc_weekDay

https://en.wikipedia.org/wiki/ISO_week_date

Should sunday be 0 or 7?
Is -1 a reasonable fallback?
Could the function or a variant thereof return strings, e.g. "MON"? Perhaps even (translated) stringtable entry?

@jonpas
Copy link
Member Author

jonpas commented Feb 16, 2022

Whichever.
Yes.
Sure.

@jonpas
Copy link
Member Author

jonpas commented Feb 16, 2022

For reference, -1 will only return on invalid input. If we switch to 1-7 for days, invalid could also be 0.

@TheMagnetar
Copy link

I would prefer -1 to be invalid. A return of 0 can be confusing since it can be interpreted still as valid. A -1 is "visually" always invalid for days of the week in all conventions

@jonpas jonpas changed the title Add CBA_fnc_getWeekDay Add CBA_fnc_weekDay Feb 16, 2022
@PabstMirror PabstMirror added this to the 3.15.7 milestone Mar 5, 2022
@PabstMirror
Copy link
Contributor

[[2101,1,1]] call CBA_fnc_weekDay; = 0
but https://www.timeanddate.com/calendar/?year=2101 says it should be a saturday
I think it's because 2100 isn't a leap year (even though it's divisible by 4)

hopefully arma 4 is out by then, so this shouldn't really be an issue 😄 (max mission date in arma is 2050)

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

Successfully merging this pull request may close these issues.

None yet

4 participants