Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!


OverviewFelgo 2 Support (Qt 5) › Wrong date returned nativeutils.onDatePickerFinished

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #22061


    I have an odd error on onDatePickerFinished, Im getting the date with  -1 day of the selected date, example:

    if I select 2019-08-13 , the nativeUtils is getting 2019-08-12, this happen on iOS, and Android(including physical devices), this works like this? or Im getting something wrong:


        Connections {
            target: nativeUtils
            onDatePickerFinished: {
                var year = 0
                var month = 0
                var day = 0


    Selected date:  13 – August – 2019



    qml: lun ago 12 19:00:00 2019 GMT-0500



    No one else is having this issue? can some one validate this error?


    Felgo Team


    Hello Alex, thank you for your answer, sorry to be late, but I was working on the backend of the app. Yes I still have the same issue, (I tested the snippet above, and still have the same issue)  I think it has to be with the Date component of the Javascript:


    But I thinks is weird the nativeutils isn’t taking on account my device locale, I would think it should give the date Im selecting.


    ps. this is the full date Im getting:   if I select today (07 -Oct – 2019)

    <b>selected date:dom oct 6 19:00:00 2019 GMT-0500</b>



    BTW,  I added the suggested function on the post on Stackoverflow, and now is working fine, but Im going to wait if there is some other way to fix this:


      onDatePickerFinished: {
                console.debug("selected date before fix:"+date)
                date =  fixDate(date)
                console.debug("selected date after fix:"+date)
    function fixDate(doo){
                return new Date( doo.getTime() + Math.abs(doo.getTimezoneOffset()*60000) )


    Selecting: 2019-10-07

    <b>selected date (before fix;):dom oct 6 19:00:00 2019 </b><b>GMT-0500</b>

    <b>selected date (after fix;):lun oct 7 00:00:00 2019 GMT-0500</b>


Viewing 5 posts - 1 through 5 (of 5 total)

RSS feed for this thread

You must be logged in to reply to this topic.