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

Power-Fx WORKDAY function #2638

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

m365solutioninsights
Copy link

WORKDAY function which returns a number that represents a date that is the indicated number of working days before or after a date (the starting date).

In Scope: Working days exclude weekends.
Out Of Scope: Holidays will not be consider in this function.

Affected Files:

  • src/libraries/Microsoft.PowerFx.Core/Localization/Strings.cs
  • src/libraries/Microsoft.PowerFx.Core/Texl/BuiltinFunctionsCore.cs
  • src/libraries/Microsoft.PowerFx.Core/Texl/Builtins/DateTime.cs
  • src/libraries/Microsoft.PowerFx.Interpreter/Functions/Library.cs
  • src/libraries/Microsoft.PowerFx.Interpreter/Functions/LibraryDate.cs
  • src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs

@m365solutioninsights m365solutioninsights requested a review from a team as a code owner September 15, 2024 17:38
@m365solutioninsights
Copy link
Author

@m365solutioninsights please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

@anderson-joyle
Copy link
Contributor

Great start. Thanks for contributing.
We will review it in the next days. I just want to point a few things that you need to include as part of the PR.

Function optional argument

We will discuss internally if the Workday function will support a 3rd optional argument (Holidays). We can check the original function description here.

Test cases

Please add a new file named Workday.txt at here. Things to consider in your tests:

  • How to handle ErrorValues as argument as arg[0] and/or arg[1].
  • How to handle BlankValue as argument as arg[0] and/or arg[1].
  • How to handle an unexpected type as earg[0] and/or arg[1].
  • How to handle coercions (given an value that supports coercion e.g Workday(4500, 10)).

Translations

I can see you were mindful to translate the text messages in all supported languages files. This is not necessary since there is an internal team responsible for that. Sorry for not letting you know sooner.

@m365solutioninsights
Copy link
Author

Hi @anderson-joyle , I have added the file Workday.txt and handled the below test cases.

  1. Error Values/ Blank values/ Unexpected type as argument as arg[0] and/or arg[1].
  2. Also, coercions has been handled in Workday function.

Pipeline is failed in VsTest step. can we connect to take it further?

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

Successfully merging this pull request may close these issues.

2 participants