QtQuick V4 Date.Parse() does not support RFC2822 date format

Bug #1298978 reported by Alan Pope 🍺🐧🐱 🦄
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Bitcoin Touch
Fix Released
High
Unassigned
Ubuntu Shorts App
Fix Released
High
Unassigned
qtdeclarative-opensource-src (Ubuntu)
Fix Released
High
Timo Jyrinki

Bug Description

I'm seeing no dates on articles, and this in the log a lot:-

file:///usr/share/click/preinstalled/com.ubuntu.shorts/0.2.179/RssFeedPage.qml:338: ReferenceError: pubdate is not defined

https://bugreports.qt-project.org/browse/QTBUG-38011

Related branches

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :
Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :
Joey Chan (qqworini)
Changed in ubuntu-rssreader-app:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Joey Chan (qqworini) wrote :

            var datestring = "Wed, 18 Sep 2013 07:00:51 -0700"
            console.log("Date.parse: ", Date.parse(datestring))

console output: Date.parse: NaN

this code works fine with v8 js engine in Qt 5.0.2 but fail with v4 js engine in Qt 5.2

I had a conversation with a dev in Qt project, he said this issue will be fixed in Qt 5.3

Revision history for this message
Alan Pope 🍺🐧🐱 🦄 (popey) wrote :
Revision history for this message
Roman Shchekin (mrqtros) wrote : Re: [Bug 1298978] Re: Articles are missing dates

Hope that Qt 5.3 will be available in time
01 апр. 2014 г. 12:45 пользователь "Joey Chan" <email address hidden> написал:
>
> var datestring = "Wed, 18 Sep 2013 07:00:51 -0700"
> console.log("Date.parse: ", Date.parse(datestring))
>
> console output: Date.parse: NaN
>
> this code works fine with v8 js engine in Qt 5.0.2 but fail with v4 js
> engine in Qt 5.2
>
> I had a conversation with a dev in Qt project, he said this issue will
> be fixed in Qt 5.3
>
> --
> You received this bug notification because you are a member of Ubuntu
> RSS Feed Reader Developers, which is subscribed to Ubuntu RSS Feed
> Reader App.
> Matching subscriptions: Ubuntu RSS Reader Bugmail
> https://bugs.launchpad.net/bugs/1298978
>
> Title:
> Articles are missing dates
>
> Status in RSS Feed Reader application for Ubuntu devices:
> Confirmed
>
> Bug description:
> I'm seeing no dates on articles, and this in the log a lot:-
>
>
file:///usr/share/click/preinstalled/com.ubuntu.shorts/0.2.179/RssFeedPage.qml:338:
> ReferenceError: pubdate is not defined
>
> To manage notifications about this bug go to:
>
https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1298978/+subscriptions

Revision history for this message
Sam Bull (dreamsorcerer) wrote : Re: Articles are missing dates

Looks like the same issue in our bitcoin-app:
  We get dates in the form of "Sat, 15 Mar 2014 16:40:20 +0000", and pass that into new Date(). In the current promoted image (250?), this results in 'Invalid Date'.

Changed in bitcoin-app:
status: New → Triaged
importance: Undecided → High
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Need to test if QDateTime::fromString() can handle this format
https://qt-project.org/doc/qt-5.0/qtcore/qdatetime.html

Looking at the parsing code there is not case for this, it seems to not be either JS std or Qt std
https://qt.gitorious.org/qt/qtdeclarative/source/722dcd2c315acc2bab1cfa9072986ca66a5bba88:src/qml/jsruntime/qv4dateobject.cpp

If QtDateTIme can handle it we may simply need to add a case for the other formats.

Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

I think the fix is adding these lines
if (!dt.isValid())
        dt = QDateTime::fromString(s, Qt::RFC2822Date);

to qv4dateobject.cpp

Changed in qtdeclarative-opensource-src (Ubuntu):
importance: Undecided → High
assignee: nobody → Timo Jyrinki (timo-jyrinki)
summary: - Articles are missing dates
+ QtQuick V4 Date.Parse() does not support RFC2822 date format
Revision history for this message
Joey Chan (qqworini) wrote :

Hope that works ...

Changed in qtdeclarative-opensource-src (Ubuntu):
status: New → In Progress
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Pat's suggested fix seems to work. The fix is now testable from https://launchpad.net/~ci-train-ppa-service/+archive/landing-008

In other words, to test:
adb shell
apt-add-repository ppa:ci-train-ppa-service/landing-008
apt-get update
apt-get upgrade

Qt Declarative's own test suite passed fine. I'll run our autopilot suites also to check if there are any regressions. If there are none I'll submit the fix to upstream and publish the fix after it has seen some sort of approval.

Note that the shorts app caches the entries, so the time will only be displayed for new ones or if the database is removed. On desktop one can do rm -rf .local/share/com.ubuntu.shorts/ for simple with/without testing.

Revision history for this message
Joey Chan (qqworini) wrote :

thanks Timo for your work

But I can't do any "apt-get upgrade" on r250 which will cause "black screen" after reboot

or can I just replace some .so file ?

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Joey: you're right, if you're not using latest trusty-proposed you probably shouldn't experiment with apt-get upgrade.

So, instead, you can try the following:
adb shell
apt-add-repository ppa:ci-train-ppa-service/landing-008
apt-get update
apt-get install libqt5qml5 libqt5quick5 libqt5quickparticles5 qmlscene qtdeclarative5-folderlistmodel-plugin qtdeclarative5-localstorage-plugin qtdeclarative5-particles-plugin qtdeclarative5-qtquick2-plugin qtdeclarative5-window-plugin qtdeclarative5-xmllistmodel-plugin

That only updates the Qt Declarative parts. To restore the old version, you can run:
apt-get install ppa-purge
ppa-purge ppa:ci-train-ppa-service/landing-008

Revision history for this message
Joey Chan (qqworini) wrote :

Oh yeah !!! everything works just like before :D

Thanks Timo for your effort

Another good news is, this bug in Qt upstream has been closed and marked done hours ago

Joey Chan (qqworini)
Changed in ubuntu-rssreader-app:
status: Confirmed → In Progress
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Thanks Joey for the confirmation :) Since there were also zero regressions in AP test runs, I published the qtdeclarative. It'll take some time for it to pass through the queues.

Changed in qtdeclarative-opensource-src (Ubuntu):
status: In Progress → Fix Committed
Joey Chan (qqworini)
Changed in ubuntu-rssreader-app:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package qtdeclarative-opensource-src - 5.2.1-3ubuntu13

---------------
qtdeclarative-opensource-src (5.2.1-3ubuntu13) trusty; urgency=medium

  * debian/patches/Support-RFC2822Date-date-format-similar-to-V8.patch
    - Support RFC 2822 format (LP: #1298978)
 -- Timo Jyrinki <email address hidden> Thu, 03 Apr 2014 05:55:24 +0000

Changed in qtdeclarative-opensource-src (Ubuntu):
status: Fix Committed → Fix Released
Changed in ubuntu-rssreader-app:
status: Fix Committed → Fix Released
Sam Bull (dreamsorcerer)
Changed in bitcoin-app:
status: Triaged → Fix Released
Revision history for this message
Joey Chan (qqworini) wrote :

Now this bug appears again in my utopic r106

sth wrong with Qt ?

Changed in ubuntu-rssreader-app:
status: Fix Released → Confirmed
Revision history for this message
Joey Chan (qqworini) wrote :

I found UT has upgraded its Qt to 5.3.0, but I remember this bug had been fixed in upstream, why it happened again ?

Revision history for this message
Joey Chan (qqworini) wrote :

I downloaded official 5.3.1 , this bug has been fixed in this version

Pls upgrade to 5.3.1 ASAP, thx

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

I'll upload a fixed Qt Declarative 5.3.0 with the patch again included.

Upstream believed this was fixed in 5.3.0 even without the patch. However, I see the problem in both Ubuntu's Qt 5.3.0 and Debian's Qt 5.3.1 with the attached test.qml, but it works with the patch.

I'm not sure if it's a local vs system-wide install issue, if using upstream installer gives a working functionality?

description: updated
Revision history for this message
Joey Chan (qqworini) wrote :

Thx Timo for your remind, official Qt 5.3.1 do not fix this bug, I just used the wrong qmlscene to execute the qml file

Now I can confirm that both Ubuntu's 5.3.0 and Digia's 5.3.1 can reproduce this bug.

Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Now fixed again in qtdeclarative-opensource-src 5.3.0-3ubuntu7, which is included on phone image #122 (and above).

Revision history for this message
Joey Chan (qqworini) wrote :

lol THX Timo

Joey Chan (qqworini)
Changed in ubuntu-rssreader-app:
status: Confirmed → Fix Committed
Joey Chan (qqworini)
Changed in ubuntu-rssreader-app:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.