Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Feature : Add dateTimeInInterval Method #526

Merged
merged 1 commit into from
Jul 12, 2015

Conversation

nicodmf
Copy link
Contributor

@nicodmf nicodmf commented Feb 27, 2015

Permit to take a date and add or substract a php recognized interval.

I'm sure this can be usefull, because i write that in one of my alice loader, but not if this can be look as good writed (long in comparison with other pretty date functions) or in your waited tasks list.

So let me know if you want i finish with csfixer, tests, rebase and all or if this is not usefull.

@see http://php.net/manual/fr/dateinterval.createfromdatestring.php
@see http://php.net/manual/fr/datetime.formats.relative.php

@note : edited directly on github for moment

@fzaninotto
Copy link
Owner

What's the difference with dateTimeBetween()? You just pass a date and an interval instead of passing two dates?

@nicodmf
Copy link
Contributor Author

nicodmf commented Apr 2, 2015

Yes that the idea.

You can pass a date from another field with alice and not an exact date.

Exemple :

EntityBundle\Entity\HourSheet:
    Hours{1..1000}:
        start: <dateTimeInInterval('-5 days', '+10 days')>
        end: <dateTimeInInterval($start, '+5 hours')>
        validated: 50%? <dateTimeInInterval($end, '+15 days')>
        sended: 50%? <dateTimeInInterval($validated, '+15 days')>
        activity: @OnlyActivity*
        user: @User*
        yard: @Yard*

After work on it, i rename the methode in my own code in:

dateTimeInInterval

@nicodmf nicodmf changed the title Add dateTimeBetweenInterval POC : Add dateTimeBetweenInterval Apr 4, 2015
@fzaninotto
Copy link
Owner

Ok, I can understand the requirement.

To avoid code duplication, please use dateTimeBetween() in your code.

Also, please add a reference of the new formatter in the README.

@nicodmf nicodmf force-pushed the patch-1 branch 2 times, most recently from 0bf748a to c53aaa6 Compare June 25, 2015 00:24
@nicodmf
Copy link
Contributor Author

nicodmf commented Jun 25, 2015

@fzaninotto Code rebased, tested and the readme is updated. I can make another changes if you want

@nicodmf nicodmf changed the title POC : Add dateTimeBetweenInterval Feature : Add dateTimeBetweenInterval Jun 25, 2015
@nicodmf nicodmf changed the title Feature : Add dateTimeBetweenInterval Feature : Add dateTimeInInterval Jun 25, 2015
@nicodmf nicodmf changed the title Feature : Add dateTimeInInterval Feature : Add dateTimeInInterval Method Jun 25, 2015
fzaninotto added a commit that referenced this pull request Jul 12, 2015
Feature : Add dateTimeInInterval Method
@fzaninotto fzaninotto merged commit 42bef72 into fzaninotto:master Jul 12, 2015
@fzaninotto
Copy link
Owner

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants