neuronetio / gantt-elastic

Gantt Chart [ javascript gantt chart, gantt component, vue gantt, vue gantt chart, responsive gantt, project manager , vue projects ]

Home Page:https://neuronet.io/gantt-elastic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

change locale code to 'zh-cn', there is error.

Lucouse opened this issue · comments

Describe the bug
in options, i change locale.code from 'en' to 'zh-cn',there is a error

TypeError: Cannot read property '1' of undefined
    at a (dayjs.min.js?a2a4:1)
    at f.c.format (dayjs.min.js?a2a4:1)
    at Object.long (GanttElastic.vue?a636:182)
    at eval (GanttElastic.vue?a636:1052)
    at Array.forEach (<anonymous>)
    at _loop3 (GanttElastic.vue?a636:1051)
    at VueComponent.computeDayWidths (GanttElastic.vue?a636:1047)
    at VueComponent.computeCalendarWidths (GanttElastic.vue?a636:998)
    at VueComponent.setup (GanttElastic.vue?a636:1144)
    at VueComponent.created (GanttElastic.vue?a636:1237)

To Reproduce
Steps to reproduce the behavior:

  1. in options, i change locale.code from 'en' to 'zh-cn'
  2. the error printed in console of browser

Expected behavior
change date format to Chinese style.

Desktop (please complete the following information):

  • OS: windows
  • Browser: chrome
  • Version: 0.9.2

did you setup language properly?
https://github.com/neuronetio/gantt-elastic/wiki/Locale

paste your config here

this is my language settings

locale: {
          code: 'zh-cn',
          'Now': '今天',
          'X-Scale': '宽度',
          'Y-Scale': '高度',
          'Task list width': '任务列表宽度',
          'Before/After': 'Expand',
          'Display task list': '任务列表显示'
        }

i know the reason. dayjs is used in gantt-elastic, so i have to import the 'dayjs/locale/zh-cn' manually.
i solved the problem when i found that dayjs is used in gantt-elastic.
https://github.com/iamkun/dayjs/tree/35e268acf075256e526b72f0a537afe58b5af1cc

gantt should work without any import, so there may be a bug, i will check it later anyway