? Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
4 Jan 2015

This pull allow to use more flexible date modifiers in default value, like now +1 day, now -10 years and more http://php.net/manual/en/function.strtotime.php#refsect1-function.strtotime-examples

test
Try create/edit existing content, and make sure that all calendar fields works as was before patch.

Then try set some default value to the some calendar field, like default="now +1 day", default="now -10 years" and make sure that the calendar display correct date

avatar Fedik Fedik - open - 4 Jan 2015
avatar jissues-bot jissues-bot - change - 4 Jan 2015
Labels Added: ?
avatar zero-24
zero-24 - comment - 4 Jan 2015

BTW:

Travis fails on this:

There were 2 errors:
1) JFormFieldCalendarTest::testGetInputAttributes with data set "normal" (array('myCalendarElement', 'myCalendarId', 'myValue', '%m-%Y-%d', 25, 45, 'myClass', true, false, '', ''), array('myValue', 'myCalendarElement', 'myCalendarId', '%m-%Y-%d', array(25, 45, 'myClass', 'readonly')))
Exception: DateTime::__construct(): Failed to parse time string (myValue) at position 0 (m): The timezone could not be found in the database
/home/travis/build/joomla/joomla-cms/libraries/joomla/date/date.php:106
/home/travis/build/joomla/joomla-cms/libraries/joomla/factory.php:530
/home/travis/build/joomla/joomla-cms/libraries/joomla/form/fields/calendar.php:172
/home/travis/build/joomla/joomla-cms/tests/unit/core/reflection/reflection.php:79
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCalendarTest.php:318
2) JFormFieldCalendarTest::testGetInput
Exception: DateTime::__construct(): Failed to parse time string (value) at position 0 (v): The timezone could not be found in the database
/home/travis/build/joomla/joomla-cms/libraries/joomla/date/date.php:106
/home/travis/build/joomla/joomla-cms/libraries/joomla/factory.php:530
/home/travis/build/joomla/joomla-cms/libraries/joomla/form/fields/calendar.php:172
/home/travis/build/joomla/joomla-cms/libraries/joomla/form/field.php:393
/home/travis/build/joomla/joomla-cms/libraries/joomla/form/fields/calendar.php:73
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCalendarTest.php:523
--
There was 1 failure:
1) JFormFieldCalendarTest::testGetInputAttributes with data set "value_is_now" (array('myCalendarElement', 'myCalendarId', 'NOW', '%Y-%m-%d', 25, 45, true, 'This is my onchange value', ''), array('strftime('%Y-%m-%d')', 'myCalendarElement', 'myCalendarId', '%Y-%m-%d', array(25, 45, 'disabled', 'This is my onchange value')))
Expectation failed for method name is equal to <string:calendar> when invoked 1 time(s)
Parameter 0 for invocation calendarHandler::calendar('2015-01-04 12:12:52', 'myCalendarElement', 'myCalendarId', '%Y-%m-%d', Array (...)) does not match expected value.
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'2015-01-04'
+'2015-01-04 12:12:52'
/home/travis/build/joomla/joomla-cms/libraries/cms/html/html.php:236
/home/travis/build/joomla/joomla-cms/libraries/cms/html/html.php:104
/home/travis/build/joomla/joomla-cms/libraries/joomla/form/fields/calendar.php:201
/home/travis/build/joomla/joomla-cms/tests/unit/core/reflection/reflection.php:79
/home/travis/build/joomla/joomla-cms/tests/unit/suites/libraries/joomla/form/fields/JFormFieldCalendarTest.php:318

https://travis-ci.org/joomla/joomla-cms/jobs/45843122

avatar Fedik
Fedik - comment - 4 Jan 2015

travis is more complicated part :neckbeard:

avatar zero-24
zero-24 - comment - 4 Jan 2015

maybe this can help travis? @Fedik mbabker@23ec2d7

avatar Bakual
Bakual - comment - 4 Jan 2015

I wonder if that has to be a feature in core. The usecase is probably quite limited and it would be easy for an extension to extend that field and implement such advanced methods.

avatar Fedik
Fedik - comment - 4 Jan 2015

@Bakual I wonder why it still not in the core :wink:
and why we support now but nothing more ...

@zero-24 thanks I will try

avatar Fedik
Fedik - comment - 4 Jan 2015

ok, test fixed.
and I added one more test case for now +1 year, so i would count it as one successful tester :smiley:

avatar infograf768
infograf768 - comment - 5 Jan 2015

@test
Looks like working, including with custom calendars as the one for Persian.
Do we need it is another story indeed.

avatar brianteeman brianteeman - change - 24 Jul 2015
Category Libraries
avatar brianteeman brianteeman - change - 10 Mar 2016
Category Libraries Fields Libraries
avatar brianteeman
brianteeman - comment - 10 Mar 2016

Would have been very useful for me this week


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5611.

avatar brianteeman brianteeman - change - 8 May 2016
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2016-05-08 13:25:31
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 8 May 2016

Thank you for your suggestion but it has been decided that this is not something that will be included in the core of Joomla.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/5611.

avatar brianteeman brianteeman - close - 8 May 2016

Add a Comment

Login with GitHub to post a comment