DateTime Error

Post your Gambas programming questions here.
User avatar
Quincunxian
Posts: 112
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

DateTime Error

Post by Quincunxian » Tuesday 12th March 2019 11:40pm

I had this error and want to confirm that its not just me.
Can someone else please try this with a DateTime box; if it is a real bug, I'll log it formally.
DateTimeBox.Value = CDate("01/01/2019")
Returns an error even though both are date Types.
Error returned is : "Type mismatch: Wanted Date , got string instead."

Gambas=3.12.90
OperatingSystem=Linux
Kernel=4.15.0-46-generic
Architecture=x86_64
Distribution=Ubuntu 18.04.2 LTS
Desktop=UBUNTU:GNOME
Theme=Gtk
Language=en_AU.UTF-8
Cheers - Quin.
I code therefore I am

User avatar
Got2BeFree
Posts: 91
Joined: Saturday 26th November 2016 2:52am
Location: Lost

Re: DateTime Error

Post by Got2BeFree » Wednesday 13th March 2019 5:05am

Where are you getting a DateTime box? The only thing I can find is a ValueBox with the type set to DateTime. Maybe I'm missing a component that has that?
sholzy

I'm wondering around lost in the past, not knowing where the present is.

User avatar
Quincunxian
Posts: 112
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: DateTime Error

Post by Quincunxian » Wednesday 13th March 2019 6:01am

Hey Sholzy,
Got actual control name wrong.....

DateBox (gb.form)
This control allows to edit a date value. It provides a little button that displays a calendar popup.

Edit: in the 'Chooser' tab.
Cheers - Quin.
I code therefore I am

User avatar
gambix
Posts: 5
Joined: Sunday 25th September 2016 5:51pm
Location: France
Contact:

Re: DateTime Error

Post by gambix » Wednesday 13th March 2019 9:59am

You must to share more code to allow us to understand your error. Tested here without problem.

Also the date must be in us style mm/dd/yyyy. in other case it return the message you have

I can just say the pb is around your use of CDate
:-P

User avatar
stevedee
Posts: 378
Joined: Monday 20th March 2017 6:06pm

Re: DateTime Error

Post by stevedee » Wednesday 13th March 2019 10:24am

Quincunxian wrote:
Tuesday 12th March 2019 11:40pm
I had this error and want to confirm that its not just me.
Can someone else please try this with a DateTime box; if it is a real bug, I'll log it formally...
No, it seems to work as expected for me on 3.12.90 (...and on 3.12.2).

The error message: "Type mismatch: Wanted Date , got string instead."
...is a funny one, because I often see this when the error is unrelated to this description (its almost like a fall-back error).


Edit: I'm running 3.12.90 on Lubuntu 18.10 with that new LXQt desktop

User avatar
Cedron
Posts: 125
Joined: Thursday 21st February 2019 5:02pm
Location: The Mitten State
Contact:

Re: DateTime Error

Post by Cedron » Wednesday 13th March 2019 11:23am

I did this in a Form_Open():
        Dim d As DateBox
        
        d = New DateBox(Me)

        d.Value = CDate("01/01/2019")
        
        Print d.Value
        
        d.X = 100
        d.Y = 100
        d.W = 100
        d.H =  20
        
        d.Show()

I got this in the console:

Code: Select all

12/31/2018 00:00:00
The date was also 12/31/2018 on the form.

Looks like a bug to me.

It also raises the question, how does one place a Form control on the form at design time if it isn't in one of the panels to the right?

Ced

3.12.2 (Behind the front lines.)
.... and carry a big stick!

User avatar
cogier
Site Admin
Posts: 646
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: DateTime Error

Post by cogier » Wednesday 13th March 2019 11:41am

I tried this and it works as expected. Is this a language problem?

I am using en_GB.UTF-8 (British)
Stevedee en_GB.UTF-8 (British) - I presume
Quincunxian en_AU.UTF-8 (Austrailia)
Cedron en_US.UTF-8 (USA) - I presume
Sholzy en_US.UTF-8 (USA) - I presume

Just a thought!

User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: DateTime Error

Post by jornmo » Wednesday 13th March 2019 11:41am

@Cedron .Move() does what you four lines did in one :)

http://gambaswiki.org/wiki/comp/gb.qt4/control/move

User avatar
cogier
Site Admin
Posts: 646
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: DateTime Error

Post by cogier » Wednesday 13th March 2019 11:45am

@Cedron .Move() does what you four lines did in one
I did not need either the following worked fine: -
Public Sub Form_Open()
Dim d As DateBox

d = New DateBox(Me)
d.Value = CDate("01/01/2019")
Print d.Value

End

User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: DateTime Error

Post by jornmo » Wednesday 13th March 2019 11:58am

cogier wrote:
Wednesday 13th March 2019 11:45am
I did not need either the following worked fine: -
Sure, but that's another story ;)

Post Reply