0

We are adding item in list with Jsom and SSOM. Following is the scenario

  1. when item is added through SSOM , we have a date field in which date is proper. Once item is added , we have an event receiver written for applying few validation, (Adding) is the method . Date is shown properly.
  2. When item is added through JSOM, we have a date field in which date is proper. Once item is added , we have an event receiver written for applying few validation, (Adding) is the method . Date is not shown properly it showing -5 hours in event reciever

While the date is store properly in the list , but the validation written in event reciever fails because of the time difference. Kindly let me know any pointer to solve it

1 Answer 1

0

I faced a similar problem recently.
Browsers handle datetimes including the timezone of the client. You may solve your problem with UTC JavaScript functions or a third party library like moment.js

Hope this helps :)

4
  • You can add some detailed steps of achieving the solution. This seems more like comment rather than answer. Please update your answer. Jul 25, 2018 at 10:24
  • @AnkitkumarMalde Detailed steps? This would require a more detailed question. OP states he requires to be pointed in the right direction. Depending on what has to be done and how it's currently done, "detailed steps" may vary a LOT.
    – xum59
    Jul 25, 2018 at 11:13
  • Date is store properly, my question why is event receiver behaving differently, when date is inserted from SSOM and JSOM
    – Ravindra
    Jul 26, 2018 at 5:30
  • you can take a look at stackoverflow.com/questions/6208676/…, nice way to better get the point with timezones. Client-side, a little snippet or moment.js can help a lot too.
    – xum59
    Jul 26, 2018 at 20:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.