Now what I want to do is, I want to transfer those values onto another date range component but each date should be 1 year earlier and at the start and end of the month. I am using these simple scripts:
Looks identical to what I tried and couldn't replicate.
If you create another daterange component and use that as the source, does the same thing occur?
ie does this happen for every daterange component you build or just this one instance?
here's my demo app for your forum (1).json (10.5 KB)
comparison:
I think it's timezones - you're GMT+0100 and I'm not.
The Moment documentation says: moment().startOf('month'); // set to the first of this month, 12:00 am
I'm wondering if the timezone shift then takes 1 hour away from 01-02-2023 resulting in 31-01-2023
what does the start date show if you change the value to:
I think with any date manipulation there are things to consider such as the timezone of the data, the timezone of the viewer, the timezone of the server performing and actions etc
I've not looked into why the behaviour is different between the components - possibly one has a time stamp and one doesn't - but what you will need to do now is check what timezone you're trying to compare and modify.
Is the date entry local to the user or is it what is stored in a database etc. Converting everything to UTC time is usually the best option and then when you're displaying it or asking for data to be entered you do the conversion into local time.
Thanks to your feedback here, we were able to identify the bug and fix it! The fix will be coming with our next Cloud release (which is usually sometime midweek)