locked
VS 2013 RC Lightswitch HTML client date format showing correctly in Chrome for Android RRS feed

  • Question

  • Does anyone know why my HTML Client app is showing dates correctly or "as I need" (DD/MM/YYYY) for output and input fields in Chrome for Android and not in: Firefox, Chrome and IE for PC that is always showing the all American classic MM/DD/YYYY

    Shall I start rendering using moment.js or the issue will be fixed by the browser?

    Shall I tell all users to switch to Android?

    Any hel on this issue will be much appreciated

    Cheers

    Sergio

    Thursday, October 17, 2013 7:13 PM

Answers

  • Hi Sergio,

    According to the discussion, I'd like to suggest you to contact Microsoft Connect  for better help:

    Microsoft Connect

    https://connect.microsoft.com/


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 29, 2013 8:49 AM
  • Thanks!

    I finally solved the problem without coding for Chrome first and for Firefox latter but did not find a solution for IE, I will post a request in the recommended site

    Thanks so much


    Sergio

    Tuesday, October 29, 2013 11:03 AM
  • OK...I had this same issue and decied to modify msls-2.5.1.js

    When msls outputs text, it doesn't check if it's a date or respect your requested date format.

    Around line 17165 in the source file, there is a function called _refreshView that I modified to look like this:

    function _refreshView(notify) {
                if (this._isViewCreated) {
                    
                    var tempDate = new Date(this.text);
                    if (tempDate instanceof Date && !isNaN(tempDate.valueOf())) {
                        if (this.data.valueModel.hasOwnProperty(":@StringValueFormat")) {
                            if (this.data.valueModel[":@StringValueFormat"].value === "d") {
                                this.text = ((tempDate.getMonth() + 1) + '/' + tempDate.getDate() + '/' + tempDate.getFullYear()).toString();
                            }
                        }
                    }
                    msls_setText(this._textElement, this.text);
                    if (notify) {
                        this._textElement.trigger("updatelayout");
                    }
                }
            }

    now any dates with a requested format of 'd' in the server side model will output correctly in IE.

    Wednesday, October 22, 2014 9:18 PM

All replies

  • Hi Sergio,

    Based on my experience, I'd like to suggest you  to use moment.js to custom formats.

    You may get more details from : http://momentjs.com/

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, October 18, 2013 12:32 PM
  • In IE it uses the locale to infer the format, so here I can switch between 'en-GB' and 'en-US' and the data formats switches between 'DD/MM/YYYY@ and 'MM/DD/YYYY'.

    w3.org date formats

    The browser user can choose if they can find the settings :O

    Cheers

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Friday, October 18, 2013 12:59 PM
  • Thanks David,

    I change language and solved the problem for Chrome for Windows.

    I changed the language and did not solved the problem in IE and Firefox.

    Probably going the moment.js way as the moderator advised before the customers complains about date formats and decimal signs.

    (I miss COBOL and the simple DECIMAL-POINT IS COMMA)

    Cheers

    Sergio


    Sergio

    Friday, October 18, 2013 5:29 PM
  • Hi Sergio,

    According to your description, I’d like to suggest you to refer  to the learning resource below:

    Date Formatting

    http://msdn.microsoft.com/en-us/goglobal/bb688124.aspx

    In addition, there is a similar problem like yours, you may go to the link below for details:

    How can I format date HTML Client

    http://social.msdn.microsoft.com/Forums/en-US/a51fb10a-b765-49c0-9a6b-b0557c1cab51/how-can-i-format-date-html-client

    Hope it helps.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 22, 2013 3:28 AM
  • Thank you Moderator, I agree with you it seems that the best way is to use moment.js and do some coding.

    I was hoping to save me some time and avoid all the work of formatting numbers and dates for output and input and wait for the browsers to work properly, but so far only Chrome does.

    Thank you for the links.

    Sergio


    Sergio

    Tuesday, October 22, 2013 10:24 AM
  • Hi Sergio,

    For reference, which IE version are you using? It works for me here in IE10 with en-GB en-US and has for a long time as far as I remember.

    Cheers

    Dave

    ps: I do use moment.js for formatting anyhow


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Tuesday, October 22, 2013 10:54 AM
  • Hi Dave I have IE 1o Version 10.0.9200.16721

    Cheers

    Sergio


    Sergio

    Tuesday, October 22, 2013 2:43 PM
  • Thanks Sergio, That is the same as me.

    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Tuesday, October 22, 2013 2:46 PM
  • Hi Sergio,

    According to the discussion, I'd like to suggest you to contact Microsoft Connect  for better help:

    Microsoft Connect

    https://connect.microsoft.com/


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 29, 2013 8:49 AM
  • Thanks!

    I finally solved the problem without coding for Chrome first and for Firefox latter but did not find a solution for IE, I will post a request in the recommended site

    Thanks so much


    Sergio

    Tuesday, October 29, 2013 11:03 AM
  • OK...I had this same issue and decied to modify msls-2.5.1.js

    When msls outputs text, it doesn't check if it's a date or respect your requested date format.

    Around line 17165 in the source file, there is a function called _refreshView that I modified to look like this:

    function _refreshView(notify) {
                if (this._isViewCreated) {
                    
                    var tempDate = new Date(this.text);
                    if (tempDate instanceof Date && !isNaN(tempDate.valueOf())) {
                        if (this.data.valueModel.hasOwnProperty(":@StringValueFormat")) {
                            if (this.data.valueModel[":@StringValueFormat"].value === "d") {
                                this.text = ((tempDate.getMonth() + 1) + '/' + tempDate.getDate() + '/' + tempDate.getFullYear()).toString();
                            }
                        }
                    }
                    msls_setText(this._textElement, this.text);
                    if (notify) {
                        this._textElement.trigger("updatelayout");
                    }
                }
            }

    now any dates with a requested format of 'd' in the server side model will output correctly in IE.

    Wednesday, October 22, 2014 9:18 PM
  • Nailed it! thanks!

    Sergio


    Sergio

    Thursday, October 23, 2014 12:07 AM