[Development] QTBUG-36811. Qml date behaves unexpectedly for negative years.

Thiago Macieira thiago.macieira at intel.com
Mon Dec 8 20:19:34 CET 2014


On Monday 08 December 2014 22:55:39 Valery Kotov wrote:
> Dear all,
> 
> I'm currently working on QTBUG-36811 (Qml date behaves unexpectedly for
> negative years). Unfortunately, I'm a little unsure how negative years
> should be handled with qml date. Actually, I've got the same confusion
> about 0 year.
> At some point qml date uses QDate class. And QDate handles negative years
> in such manner: if a year is less or equal to 0, it decrements it. It seems
> to be correct as far as there is not such thing as 0 year.

Correct. Instead of saying "year 0 is the first year before year 1", QDate 
simply discards year 0 dates. The day before Jan 1, year 1 CE is December 31, 
year 1 BCE.

> On the other hand, I can't find any specific information how negative dates
> should be handled in java script. "A four-digit value representing the
> year, negative values are allowed" is the only piece of information which I
> could find. It turned out from experiment that neither Chrome nor Firefox
> convert year. They set year value to the one is passed to setYear method.
> I'm a little bit confused. Do you probably know how qml date class should
> handle 0 year and negative years?

Just do the check I did above: What is the day before 0001-01-01?

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list