the first problem i have is that in my app based on input value changed i need a set state and in that set state i want the value section to a equation like 24 divided by the input and bubble wont allow me to do that
the second problem which is the big one i need a to extract a days of the month based on a date time picker and i need to save that data in a state so i can use it later
Your right, Bubble doesn’t allow literal number values at the start of an expression (for some reason), so to do what you need just create a custom state (number) with a default value of 24, and use that at the start of your expression.
(alternatively, use Arbitrary Text, type 24, the cover it to a number).
As for your second question, I’m not entirely sure what you mean, but you can extract anything you want from a date value, and save it anywhere you like.
first thank you
second what i mean that i want the user to select a month just a month and i need the month number of days like december is 31 days and it should return 31 as a number so i can use in my logic
You could consider using an option set with the months as the options and an attribute for the number of days in each month. Then, when a user selects a month, use the month’s attribute in your expression(s).
To get the number of days in a specific month you can use a free plugin, I believe Calendar Tools can do this, as you will want to incorporate the idea of leap years when certain months don’t always have the same number of days.
Or you can use the built in dynamic expression operators to manipulate the date selected so you can say something like date picker value change date to 1 so you have your starting date and put that into a custom state called ‘start’ and then have an expression to manipulate the custom state called ‘start’ to say something like start value +months 1 +days-1 and save that to a custom state called ‘end’ then you can use the dynamic expression operators to subtract the end date from the start date and convert to days to get a number of days for the selected month.
I went with the option set suggestion since OP said they wanted the user to be able to select just a month (and yes, I had thought about leap year, but I pretty much dismissed it without knowing more about what OP is trying to do). That being said, if OP wants to get the number of days in a month based on a date selected from a date picker, all they need to do is extract the date fromdate picker's value +(months): 1 +(days): -1. There shouldn’t be a need for a start value or any subtracting of dates, unless I am missing something here.
Yes, I think the OP wants to get a number which is the number of days within the month.
This just manipulates the date so that you have the last date of the months’ value, so for December it would just return a date of December 31 and not a number of 31. In order to get a number which is equal to the number of days in the particular month, it would be necessary to know the first and last date of the month, and subtract the values to arrive at a total number of days in the month.
At least that is my interpretation from the quote of the OP as to what they are looking to achieve.