Is the current date the time on the users computer?

Hi,

I am recording subscription date when user sign up using current/date time.
But I checked the database and I found subscription dates way ahead than the current date.

Is it getting the record from the users computer current date time?

https://manual.bubble.io/core-resources/data/data-sources#current-date-time

Holy crap! This is bad

How do I set it up that it is standardize when a user sign up anywhere in the world?

You can always use a backend workflow to set that date, so you get the current date of the server.

Also have a look here for more docs about dates in bubble

It really depends on what date you think ā€˜todayā€™ is.

The bubble server is in western USA. So that might be yesterday.

Could use UTC. But that might be tomorrow.

2 Likes

I am fine with that if its in USA time. I just need everything standardized.
Any way on how to do this without using backend workflow?

If you donā€™t trust the clientā€™s current date then you need to use the backend.

If you are worried about storing dates in the database all in the same format then bubble is already doing it for you.
From the docks

This type represents a precise moment in time (measured to the nearest millisecond)

The date stored in the database has nothing to do with timezones.
Displaying and doing some operations on dates depends on timezones.

1 Like

When you say ā€˜way ahead than the current dateā€™, how much ahead are you talking about (days, weeks)? Iā€™m guessing not more than a few hoursā€¦

In any case, a date in Bubble is a timestampā€¦ so it shouldnā€™t matter what time zone you or anyone else is inā€¦ the timestamp is the same (now is now, wherever you are)ā€¦

So perhaps youā€™re getting confused by seeing that date (timestamp) formatted in a way that is different from the time zone you are in?

But the actual date (i.e. the timestamp) is fixed, and assuming youā€™re recording it correctly (i.e. at the precise moment a User subscribes), then whatever time zone itā€™s being formatted in (intentionally or otherwise) is irrelevant.

2 Likes

Basically, what I want to happen is that when a user subscribes to a PRO plan on my app, I will catch his/her subscription date which I use so that on the 30th day of their subscription then I will renew their credits.

THe problem was when I saw PRO users and shocked to see that their subscription dates is way off!
So my entire logic of renewing subscription is a goner.

For example, a user earlier subscribed to a PRO, but I saw in DB that the subscription date is on March 01, 2023. Uh Oh!

It is totally way off
A user subscribed to a PRO plan but subscription date on DB record was March 03, 2023

How are you recording the subscription date?

This is how I save when someone converts to a PRO plan

Any advice?

image

This is how I renew credits on backend workflow

You are adding 30 days to the subscription date. Of course you see a date different from today

2 Likes

I guess you are forgetting that February has less daysā€¦? :yum:
@rccanlas2

3 Likes

No It will only add 30 days when it only renewed after the months subscription

It shouldnā€™t add 30 days when on first sign up to PRO
Most of my PRO users have the correct date, only a few of them have an abnormal subscription date

No It will only add 30 days when it only renewed after the months subscription
It shouldnā€™t add 30 days when on first sign up to PRO

Well, evidently, thatā€™s whatā€™s happening (i.e. 30 days from today is 3rd March 2023)ā€¦

So you need to start investigating why your workflow is triggering when you think it shouldnā€™t be triggering.

2 Likes

@adamhholmes and @dorilama , I donā€™t think this is the problem here, because he is adding +30 days in the end of the plan (I believe, 30 days after subscription date), and he is adding this 30 days from the date of subscription, not from current date/time.

@rccanlas2 How did you configured the ā€œRecurring eventā€ to renew your userā€™s credits?

but the Subscription date IS the current date/timeā€¦

but yeah @rccanlas2 ā€¦ how and where are you starting the recurring workflow?.. (Iā€™m pretty sure the answer lies thereā€¦)

But the renew event only happens 30 days after the subscription is madeā€¦

If this event is beeing triggered in the end of the monthā€¦

  1. User subscribed in January 30th;
  2. In January 31th the event was triggered;
  3. That user have his SubscriptionDate changed to January 30th + 30 days;

The correct thing to do is to schedule the renewing workflow. Not work with recurring events.

1 Like