Forum Academy Marketplace Showcase Pricing Features

Date type: change function

Hello,

I just tested the change function of the date type and it seems like there is a bug with it: I first created a new date and gave it the value of current date time to then see how it behaves when I change the hour, minutes, seconds, day, year or month.
The problem is: sometimes it works well, sometimes it doesn’t.
For instance, sometimes:

  • I change month to 5 (May), and the result is June;
  • I change the month, but the hour changes instead;
  • when I change all at the same time: seconds, minutes, hour, and day to 0, the result is never the same;
  • etc.

I need that function for my app because I want all the dates to have the same value for seconds, minutes, hours and days, so that I could just focus on month and year values.

Can you share a link to your app? Or some screenshots of the workflow that you have which changes the date’s value?

Yes, sure: https://app0test.bubbleapps.io/version-test/change_date

Thanks!

I see what you mean, it does do weird things!

Ok,

My thoughts are that the problem occurs when you set things to 0. Zero is not a valid date. Also, everytime you make a change, you are writing to the database, and then waiting for the that to commit to update the display. So i would suggest you make changes in the front end by manipulating a custom state value and then write back to the database.

Take a look at the changes I made to the Change date to 0 buttons workflow, which now sets a customstate to 1-Jan-1970 and then writes this back to the database. You should take the same approach for the other workflows.

This is what i do with the custom time selector demo, it is effectively making changes to a date value using slider controls.

I am not sure if that was you or someone else in the app at the same time, but that is me finished messing about, I have changed a few more things, and it is all working as expected now!

Thanks for your reply!

Actually, the bug also occurs (sometimes) when you just change the month, so it’s like the whole function does weird things randomly.
First, I was thinking like you: that the problem was linked to the value 0, but when I set all to 1, the problem is the same.

I just looked the changes you made on the page, and it seems to be fixed with the custom state, thanks a lot, even I still find it weird that it doesn’t work directly on the database, without the custom state.

I made a few tests to undertand more your changes and it still doesn’t work finally.
I mean, you chose to display the custom state which gives the impression that it works but when you look into the database, the value assigned by the custom state is different from the real value of the data.

For instance, I clicked on the button “change to 1 jan 1970”, it worked well at this stage.
Then I cliked on the button “change day to 8” and the value on the database changed to: 9 Dec 1969

Looks like there is a bug in there somewhere then.

I suggest you raise a formal bug_report so that the @Bubble team can take a look at it in a bit more details.

Yes, I will take your advice and report the bug, thanks for your time!

1 Like

This topic was automatically closed after 14 days. New replies are no longer allowed.