J3 Issue ?
avatar JakobSulby
JakobSulby
20 Jul 2017

Steps to reproduce the issue

  1. Create a calendar field for an article.
  2. Set the date before 1900.
  3. Press enter.

Expected result

The date is set no matter how old the date is.

Actual result

The date field is cleared.

System information (as much as possible)

Clean installation of Joomla 3.7.3

Additional comments

It might have something to do with a default value for the minyear argument. Anyway, you should be able to select older dates. Why are there even a limit to this? Also, why is the minyear only relative and no option to set fixed.

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar JakobSulby JakobSulby - open - 20 Jul 2017
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Jul 2017
avatar franz-wohlkoenig franz-wohlkoenig - change - 25 Jul 2017
Status New Confirmed
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 25 Jul 2017

Issue confirmed. Test com_fields in Article.


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

avatar infograf768
infograf768 - comment - 25 Jul 2017

I am not sure we can set dates older than 1900 in a gregorian calendar (because of UNix limits).

avatar tonypartridge
tonypartridge - comment - 27 Jul 2017

I thought we were limited to 1970 due to unix oimitations. We are validating the dates here so it wouldn't be possible. Alternatively if you needed it in a custom field you could write a custom field to handle it without specific calendar validation. And instead Store as a string.

avatar brianteeman
brianteeman - comment - 27 Jul 2017

@tonypartridge no it will go back to 1900 - just take a look ;)

		JoomlaCalLocale.minYear          = JoomlaCalLocale.minYear ? JoomlaCalLocale.minYear : 1900;
		JoomlaCalLocale.maxYear          = JoomlaCalLocale.maxYear ? JoomlaCalLocale.maxYear : 2100;

https://github.com/joomla/joomla-cms/blob/staging/media/system/js/fields/calendar.js#L75

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 27 Jul 2017

so its expected Behaviour?

avatar brianteeman
brianteeman - comment - 27 Jul 2017

It is working as designed BUT that doesn't mean it is correct.

@dgt41 is there a reason for those min and max values?

avatar dgt41
dgt41 - comment - 27 Jul 2017

@brianteeman I thought that we covered that in the layout: https://github.com/joomla/joomla-cms/blob/staging/layouts/joomla/form/field/calendar.php#L128-L129

So with an override you could have user defined values for minimum and maximum year!
PS. If it's multilingual, with mixed calendars (e.g. jalali + gregorian) the override might need to pass the right values depending on the language.

avatar Fedik
Fedik - comment - 27 Jul 2017

limitation comes from use of strtotime() functions in the calendar.
you can save any date in MySQL but it can be broken by strtotime()
see notes http://php.net/strtotime

php DateTime has no such limits

avatar dgt41
dgt41 - comment - 27 Jul 2017

@Fedik you are right but only for 32bit installations

Quoting

For 64-bit versions of PHP, the valid range of a timestamp is effectively infinite, as 64 bits can represent approximately 293 billion years in either direction.

avatar Fedik
Fedik - comment - 27 Jul 2017

also true

avatar dgt41
dgt41 - comment - 8 Aug 2017

Not sure if there is a bug here, as we have

  • a way to pass custom minimum and maximum year
  • there is a known limitation with strtotime() and 32bit versions of PHP
avatar franz-wohlkoenig franz-wohlkoenig - change - 7 Nov 2017
Status Confirmed Discussion
avatar brianteeman brianteeman - change - 25 Mar 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 25 Mar 2018
avatar Quy
Quy - comment - 20 May 2019

OK to close?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 21 May 2019

closing - issue can always reopened if needed.

avatar franz-wohlkoenig franz-wohlkoenig - close - 21 May 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 21 May 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-05-21 03:41:08
Closed_By franz-wohlkoenig

Add a Comment

Login with GitHub to post a comment