The locale of dates has always been changed to Chinese

Posted by: nvnhat.17ck1 on 28 December 2023, 4:10 am EST

    • Post Options:
    • Link

    Posted 28 December 2023, 4:10 am EST - Updated 28 December 2023, 4:11 am EST

    Hi @SpreadJS,

    We have issues that the locale of dates has always been changed to Chinese.

    Step reproduce:

    1. Input Date Value
      • eg. 02/02/2023
    2. Format Cell:
      • Right click on this cell, Chose Format Cells
      • Choose either “UK” or “Korean” from the “Locale” dropdown list. Select Type: yyyy-mm-dd format (eg: 2001-03-14)
      • Click “OK” to apply the formatting.
    3. Save file with .sjs
    4. Refresh page
    5. Open the previously saved .sjs file
    6. Carefully inspect the date format of the cell that was formatted in step 2. It always show Chinese(China) locale.
  • Posted 28 December 2023, 4:14 am EST

    Please check attachment files.

    UK_Korean_changed_to_Chinese.zip

  • Posted 28 December 2023, 10:55 pm EST

    Hi,

    I am currently investigating the issue at my end. I will update you about my findings soon.

    Regards,

    Ankit

  • Posted 1 January 2024, 4:02 pm EST

    Hi,

    Apologies for the late response and thanks for the detail steps. I was able to replicate the issue at my end with the latest version of SpreadJS V17.0.0. It does seem like an issue with the SpreadJS Designer Component and therefore, I have escalated the issue to the dev team for further investigation.

    The internal tracking id for the same is: SJS-22119 and I will let you know when there is more info on this from the dev team.

    Regards,

    Ankit

  • Posted 2 January 2024, 7:01 pm EST

    Hi Ankit, do you have any updates on this one?

  • Posted 3 January 2024, 8:33 pm EST - Updated 3 January 2024, 8:38 pm EST

    Hi,

    The devs have mentioned that the observed behavior is by design. You could try the same steps in Microsoft Excel. You will find that the format dialog date format will always be located in the English Culture.

    You could refer to the below gif that shows the behavior in Microsoft Excel.

    Further, the devs have mentioned that the date and culture are decided by the culture’s predefinedFormats. In the case, Chinese Culture has the same format pattern on “yyyy-mm-dd;@” with the Korean Culture, and hence the Chinese Culture is selected.

    If you want to achieve the same behavior as Microsoft Excel i.e. always open the English Culture, you could add the “yyyy-mm-dd;@” format to the English Culture or remove the “yyyy-mm-dd;@” format from the Chinese Culture’s predefinedFormats.

    Use the following code snippet to add the “yyyy-mm-dd;@” format to the predefined formats in English Culture.

    var enCulture = GC.Spread.Common.CultureManager.getCultureInfo("en-us");
    enCulture.predefinedFormats['Date'].push("yyyy-mm-dd;@");

    Sample: https://jscodemine.grapecity.com/share/BLb4dobfgkm_jyo5Y8fHjA/?defaultOpen={"OpenedFileName"%3A["%2Findex.html"%2C"%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    You could refer to the below gif that shows the steps followed in the above sample. You could observe that now the “English” culture is always opened the same as Microsoft Excel.

    Regards,

    Ankit

  • Posted 11 January 2024, 3:33 pm EST

    The problem can only be solved when we set the culture to en-us. If we set the culture to en-bg (UK), the problem still occurs. We think that MS Excel is giving priority to current culture formats while SpreadJS is not.

  • Posted 14 January 2024, 5:58 pm EST - Updated 14 January 2024, 6:04 pm EST

    Hi,

    Microsoft Excel, being a native application, takes culture information from the culture of the machine running the Microsoft Excel. However, in case of SpreadJS, being a web application, it does not have access to system information such as culture, and therefore, you need to explicitly set the culture and related information.

    I tested with the “en-GB” culture and it seems to be working fine at my end. At my end, it is showing the English Culture.

    You may refer to the following sample that I have tested with and also the attached gif that shows the steps.

    Sample: https://jscodemine.grapecity.com/share/PCNOp3e1l0mKi2ns1h0S3g/?IsEmbed=false&Theme=Unset&PreviewDirection=0&IsEditorShow=true&IsExplorerShow=true&IsPreviewShow=true&IsConsoleShow=true&IsRunBTNShow=false&IsResetBTNShow=false&IsOpenInCodemineBTNShow=false&PanelWidth=20&PanelWidth=50&PanelWidth=30&defaultOpen={"OpenedFileName"%3A["%2Fsrc%2Fapp.js"]%2C"ActiveFile"%3A"%2Fsrc%2Fapp.js"}

    In the gif, you could see that it opens the English every time. Further, if you want to customize the Filter Dialog for custom culture, you may refer to the following docs: https://developer.mescius.com/spreadjs/docs/spreadjs_designer_component/customizations/designer-customize-culture

    Regards,

    Ankit

  • Posted 14 January 2024, 6:20 pm EST

    Thanks Mr. Ankit!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels