a month ago
DATE HANDLING in UI5/Fiori apps.
Scenario 1 - Reading Date from Date Picker ==> Whenever user selects any date from date picker, I want to get the UTC date.
For example - I am working in IST time zone and if I select the date 17-Oct-2025 in date picker and when I read it in my change event handler I get the date as 17-Oct-2025 based on local time zone. But when I tried to get the UTC date, it will be 16-Oct-2025.
My expectation is when user selects 17-Oct-2025 irrespective of local time zone, model property(VALID_TO) will be set to UTC date '17-08-2025T00:00:00Z'. I am doing something like this to achieve this.
Date Picker Code in UI view -
Date Change Event Handler - HandleDateChange in Controller
I would like to hear your thoughts on the common date scenarios mentioned above. Additionally, please inform me whether the code provided above is useful or not.
Thanks,
Dhiraj More
Request clarification before answering.
Have you checked our documentation Dates, Times, Timestamps, and Time Zones?
In general, I recommend to use the matching Edm-Type for what you want to achieve. If you want to have a date only, then using Edm.Date is the best that could be done. (With OData V2, the equivalent would be Edm.DateTime with display-format="Date".)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 17 | |
| 8 | |
| 8 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.