[Qt-interest] QDateEdit minimum date is year 100
Maximilien Renard
iixamaxii at gmail.com
Wed Mar 10 19:14:23 CET 2010
Hi John,
Here is the link, you might be right about the cause of the problem but as
you can see with link provided below, it was stated that the bug was related
with QDateTime. I cannot figure out why it would be, since it works as
expected but I didn't take a look so I couldn't know!
http://bugreports.qt.nokia.com/browse/QTBUG-277
<http://bugreports.qt.nokia.com/browse/QTBUG-277>What I'd really like would
be a QDate(Time)Edit widget where the date would be displayed correctly
whatever it is (not limited to 100-01-01) and that it would not display
anything (or just the chosen separating characters) if the provided date is
0000-00-00.
That way, it would be clear to the program user that when the field is left
blank, the date is not set :)
Thank you for answer and your time !
Kind regards,
Maximilien
On 10 March 2010 18:55, John Layt <johnlayt at googlemail.com> wrote:
> On Wednesday 10 Mar 2010 16:30:21 Maximilien Renard wrote:
> > Hi there,
> >
> > I'm currently developing a electronic patient record managing program and
> > I've stumbled upon a quite annoying problem.
> >
> > QDateEdit allows a minimum date only back to the 100-01-01. I've checked
> > the Qt bug tracker and found an issue about this problem that was closed.
> > It was said that Qt developers would take a look at this for the release
> > of Qt 5.0
> >
> > After having checked, I found that QDate lets us input any kind of dates
> > (including negative years).
> >
> > It seems that the issue is difficult to fix since they plan to look at
> this
> > only with the release 5.0 (when is that planned btw ?) but couldn't it be
> > possible to make the QDateEdit display 0000-00-00 when a any date below
> > 100-01-01 is given and return an invalid or null date when calling date()
> ?
> > Although I haven't checked the source code of Qt yet, it doesn't seem to
> me
> > that this should be that difficult. It would be a quick but very useful
> fix
> > for people using databases (like me :P) since the date 0000-00-00 is used
> > as the null date (with MySQL at least).
> >
> > My questions are the following : 1) What do you think about this idea ?
> 2)
> > I'm not familiar with bug tracker, should I create a new issue to make
> this
> > suggestion or is this the place to do it (in which case there would be
> > nothing else to do but wait for an answer :) ) ?
> >
> > Thank you very much for your future answers,
> >
> >
> > Kind regards,
> >
> >
> > Maximilien Renard
> > ULB - MA1 Ingénieur Civil Biomédical
> > maximilien.renard at ulb.ac.be
>
> Interesting, what bug number was this so I can have a read?
>
> I suspect the problem with QDateEdit is that the historic behaviour for the
> now deprecated QDate::setYMD() is that 2 digit years are translated as
> meaning
> 1900-1999, whereas QDate::setDate() takes the year exactly. So rather than
> being technically hard, it's probably the backwards-compatible guarantee
> that's causing the issue?
>
> Can you clarify exactly why the current behaviour causes you a problem, do
> you
> want your users to be able to enter invalid or null dates? I can see a
> reason
> for null dates, in which case the more obvious option would be to allow a
> blank entry rather than 0000-00-00, especially given that you can set
> different date formats for input that may not so neatly have 0 equivalent?
>
> Cheers!
>
> John.
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
Maximilien Renard
ULB - MA1 Ingénieur Civil Biomédical
maximilien.renard at ulb.ac.be
+32 476 63 68 92
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100310/9f93cec0/attachment.html
More information about the Qt-interest-old
mailing list