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

Valery Kotov kotov.valery at gmail.com
Sat Dec 13 12:34:56 CET 2014


Dear Ulf,

Thank you for the answer and for such comprehensive explanation. Now it is
clear. =)

On Thu, Dec 11, 2014 at 2:18 PM, Ulf Hermann <ulf.hermann at theqtcompany.com>
wrote:
>
> @Ulf Ulf, thank you for pointing at related bug. It seems to me that
>> you've already fix the issue, haven't you? Is it correct that the
>> solution is to add 1 year to qml date object when the year is less
>> than 0?
>>
>
> My solution in https://codereview.qt-project.org/#/c/98065 and
> https://codereview.qt-project.org/#/c/98174/ works for the common cases,
> but has some drawbacks. The most important one is that you cannot parse or
> print any year 0 date in anything but ISO 8601. That may violate section
> 15.9.5.2 of the ECMAScript standard where it says:
>
>  NOTE For any Date value d whose milliseconds amount is zero, the result
>> of Date.parse(d.toString()) is equal to d.valueOf(). See 15.9.4.2.
>>
>
> With my patches you can construct such a value with year == 0 in ISO 8601,
> then do toString() on it and get "Invalid Date". This you cannot parse
> anymore. However, without my changes no negative date re-parses correctly,
> so it's still an improvement.
>
> Note that the standard does not state any relation between ISO 8601 and
> any other date format. That is all "implementation-dependent". ISO 8601
> certainly has a year 0 and QDate ignores that. But as we don't use QDate
> for the parsing and generation of ISO 8601 in JS, we should be able to get
> that right. I'll take another look at the changes.
>
> --
> Ulf Hermann, Software Engineer | The Qt Company
>
> Digia Germany GmbH, Rudower Chaussee 13, D-12489 Berlin
> Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja Sitz der
> Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB
> 144331 B
>
> Email: ulf.hermann at theqtcompany.com | Mobile: + 49 151 68964561 | Phone: +49
> 30 63 92 3255 www.qt.io |Qt Blog: http://blog.qt.digia.com/ | Twitter:
> @QtbyDigia, @Qtproject | Facebook: www.facebook.com/qt
>


-- 
Sincerely yours,
Valery Kotov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20141213/e48b3be8/attachment.html>


More information about the Development mailing list