web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / OpenForm with Date Onl...
Power Apps
Answered

OpenForm with Date Only parameter values off by one day (Model-driven)

(0) ShareShare
ReportReport
Posted on by 311

In my model-driven app, I'm opening a form from javascript using Xrm.Navigation.openForm with parameters to auto populate some fields.  One of the fields is of type Date Only, with behavior set to "Date Only".  I'm assigning the parameter value with a string formatted as "yyyy-MM-dd".  When the form opens, the value is off by one day.  For example, if it assign the parameter the value "2021-09-02", the form opens with the field value of "9/1/2021".

 

This seems like a bug to me.  Anyone know of a fix other than adding code in the OnFormLoad event to add 1 day to each Date Only value?

I have the same question (0)
  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    Hi @tschopp , 

     

    I suppose that the problem is about the user time. When you use in javascript, the Date() it will be automatically converted to user time.

    When I make a new Date for 2nd Aug 2021, I get 2021-09-01T22:00:00Z (in my case Central European Sommer Time)

    DianaBirkelbach_0-1630833761681.png

    The "DateOnly" wil be considered on the server side, when saving, but I guess this date is parsed in javascript.

     

    One way would be to pass the date including the hour:

     

    new Date(2021, 8, 2).toISOString()

     

    If this doesn't work, as a cheap workaround, I suggest passing the date for 12 a clock. That should be the same day for all time zones.

     

    new Date(2021, 8, 2, 12).toISOString()

     

     

    Hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 545 Most Valuable Professional

#2
Haque Profile Picture

Haque 314

#3
Kalathiya Profile Picture

Kalathiya 234 Super User 2026 Season 1

Last 30 days Overall leaderboard