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 the DAYS() function #594

Closed
wants to merge 2 commits into from

Conversation

biserantonov
Copy link

Adds the DAYS() function

This is:

- [ ] a bugfix
- [x] a new feature

Checklist:

Why this change is needed?

The DAYS() function was not implemented so this PR adds it

Fixes #593

Copy link
Member

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising ! only a few changes required to be merged and also please add it to the changelog

*
* @category Date/Time Functions
*
* @param mixed $endDate Excel date serial value (float), PHP date timestamp (integer),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type should enumerate all possibitilies here: \DateTime|int|float|string

$startDate = Functions::flattenSingleValue($startDate);
$endDate = Functions::flattenSingleValue($endDate);

if (is_string($startDate = self::getDateValue($startDate))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid assignment within condition and do it beforehand instead

if (is_string($startDate = self::getDateValue($startDate))) {
return Functions::VALUE();
}
if (is_string($endDate = self::getDateValue($endDate))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

@@ -0,0 +1,89 @@
<?php

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests cases miss a few cases for different input type such as DateTime, int and float

@stale
Copy link

stale bot commented Oct 5, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

@stale stale bot added the stale label Oct 5, 2018
@stale stale bot closed this Oct 12, 2018
@PowerKiKi
Copy link
Member

Merged in 2c981e4

@oleibman oleibman removed the stale label Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants