2

I am having problem in creating a shipment in MAC Operating System. In windows operating system the website works fine. Any Help would be appreciated

Thanks.

Code:

createOrUpdateShipment: function (shipmentHeader) {


----------

        var tzm= (/\((.*)\)/.exec(new Date().toString())[1]);
        return $http.post('/shipment/CreateOrUpdateShipment?tzm='+tzm, shipmentHeader)
    },

And in the Controller

 public ActionResult CreateOrUpdateShipment(ShipmentInfo shipmentInfo, string tzm)
    TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(tzm);
shipmentInfo.ServiceInfo.READYDATETYPE =       TimeZoneInfo.ConvertTime(shipmentInfo.ServiceInfo.READYDATETYPE,tzi);  

Below Error I am getting when I try to create the shipment using MAC Operating System

Getting error time zone not found exception. The time zone ID 'CST' was not found


DeanOC
  • 7,142
  • 6
  • 42
  • 56
Izaz
  • 21
  • 1
  • 1
  • 2

1 Answers1

3

Time zones in .NET are identified by their full names, not their abbreviations. You are making a call to FindSystemTimeZoneById. This API would expect "Central Standard Time", not "CST".

I would guess that your Mac client is sending tzm=CST and your Windows client is sending tzm=Central+Standard+Time. Your server only works when the client spells it out.

Michael Gunter
  • 12,528
  • 1
  • 24
  • 58
  • 1
    See http://stackoverflow.com/questions/15302083/timezone-abbreviations for more information about time zone abbreviations. – Michael Gunter Feb 08 '17 at 21:17