0

I have created angular js date picker which picks up the date time but on server side shown as 5 hours 30 minutes lesser than the selected datetime. I need to fix this on angular js side.How to achieve this fix?

I have created code for this upto now:

<input type="text" class="form-control"
       datepicker-popup="{{schedule.Date | date:'yyyy-MM-dd HH:mm:ss'}}"
       name="Date" ng-model="schedule.Date" is-open="opened"
       datepicker-options="dateOptions" ng-required="true"
       close-text="Close" />
georgeawg
  • 48,608
  • 13
  • 72
  • 95
s Jagathish
  • 57
  • 1
  • 10
  • Your client and server are in different timezones due to which this is happening. Check above question. – Vikasdeep Singh Jun 21 '18 at 07:57
  • Bro I'm checking in my local pc not any servers.I know about Time zones might be causing the error.How to fix this? – s Jagathish Jun 21 '18 at 08:01
  • Did you check the question I mentioned in my first comment? – Vikasdeep Singh Jun 21 '18 at 08:01
  • Should your client not be displaying the date appropriate for who's viewing it? Why would the user care what time it was for the server, they dont even know where the server is ... – Protozoid Jun 21 '18 at 08:04
  • Yes bro.They suggests to fix it in server side but I need to fix it using angular js attributes alone.How could I achieve this bro? – s Jagathish Jun 21 '18 at 08:04
  • Is your server storing ALL dates in the +5:30 timezone? Or what's the point of converting the client-side date in a specific timezone? Your server should store agnostic dates which your client can interpret. The server getting the Date -5:30 is correct because server shouldnt have timezones. – Protozoid Jun 21 '18 at 08:11
  • I agree with you.For +5:30 need to add,do I should done on Scripting or server side? can't be done the same with in attribute of date-picker? – s Jagathish Jun 21 '18 at 08:40

0 Answers0