locked
UK project that works with their time dosen't work on my localhost RRS feed

  • Question

  • User254389092 posted

    On a new project I received from a client(UK),  I have a date and time picker from textbox, this is working on their local machines and time systems(even production). But unfortunately, as I am in India, it does not work on my machine and returns error "

    <form class="max-size" id="reviewSubscription" action="/PolicyHubAdmin/Review/SaveSubscription" method="post" novalidate="novalidate">
    • The value 08/31/2019 17:21 is invalid
    </form>

    "

    This happens even when I turn my timezone to UK. I think it is not a code error as it is working on their machines and servers. Can anyone give me a proper fix on this.

    Regards,

    Luc 

    Saturday, August 31, 2019 5:28 PM

All replies

  • User475983607 posted

    The issue is not the timezone.  Date formats are different across cultures.  This is configured when first setup your computer.

    The standard DateTime documents explain the concept.

    https://docs.microsoft.com/en-us/dotnet/api/system.datetime?view=netframework-4.8

    https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings

    https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings

    Saturday, August 31, 2019 6:24 PM
  • User-719153870 posted

    Hi Lucifer_deep,

    The value 08/31/2019 17:21 is invalid

    According to this error message, you might need to change the date related information you get from your datepicker.

    You can use like .ToString("d") or other method you can find to change this data into a valid one in your country.

    For more information, you can refer to this article in MSDN.

    Best Regard,

    Yang Shen

    Monday, September 2, 2019 8:44 AM
  • User254389092 posted

    Thanks,

    The difference I think is between the culture. As mgebhard suggested, but when I change my system time to UK format, I get an build errors and in the normal time(IST time) it runs with that issue. Need to find a work around for that.

    Luc

    Tuesday, September 3, 2019 12:47 PM
  • User475983607 posted

    I recommend contacting your client and asking for help understanding the design as related to culture.  The last thing you want to do is create a "Work Around" that breaks the design intent.

    Tuesday, September 3, 2019 1:07 PM
  • User254389092 posted

    Hi mgebhard,

    The project is mostly used in UK and used only  UST as their time zone. I need to make it work from my end. I tried changing my system time, etc, but everything failed. Any suggestions on how to make this work on my machine. As you said, "Work Around" is not an option here. This sounds to be a configuration issue. Need to check it more.

    Wednesday, September 4, 2019 11:55 AM
  • User475983607 posted

    Keep in mind, that you have not shared any code.  The only item shared is a validation error.  I assume this is a user error where you are not entering the expected date format.  IMHO, you should know how to enter a date since you have the validation logic, 

    Again, I recommend that you contact the client for assistance.  The client should be able to explain the validation requirements.  Otherwise, share enough code to reproduce this issue and include the steps to reproduce the issue.  

    Wednesday, September 4, 2019 12:08 PM
  • User753101303 posted

    AFAIK UK uses dd/MM/yyyy rather than MM/dd/yyyy which is for US. What if you try 31/08/2019 5:21 PM rather than 08/31/2019 17:21 (or this the format for your own culture?)

    It could be also that they are hosting on a UK server and never noticed an issue.

    If a site is intended for a single culture, IMO the first step would be to use https://www.c-sharpcorner.com/article/globalization-using-Asp-Net/ to configure the server side to always use the intented culture regardless of particular server settings.

    Then you may have to solve a client side if the app doesn't handle this as well. It is still useful to make 100% sure their intent is to make this site always use the UK culture for everything...

    Wednesday, September 4, 2019 12:10 PM