question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

weekdaysShort only return the first day

See original GitHub issue

Hi there, I facing a strange bug of dayjs locale that I can’t reproduce on fiddle 😢 It only occur on my projects, this isn’t the first time I used dayjs, but this is the first time I facing this problem. I know I should create reproduce steps but I can’t because my projects is too large and I trying to replace moment by dayjs so it have a lot of changes 😢

https://github.com/iamkun/dayjs/blob/8cf4d2d608b3cf99863b3ae77467dc8b9d83e729/src/index.js#L284 Sometime, the locale.weekdaysShort (line above) return only the first item of the full list, so it will result in a error on line below because arr[index] will be undefined: https://github.com/iamkun/dayjs/blob/8cf4d2d608b3cf99863b3ae77467dc8b9d83e729/src/index.js#L262

I debugging a half of day but I can’t find out why it occur, below is image that I captured when debugging directly on dayjs.min.js built file, please see it for more information because It really hard to describe by comment 😢

A strange point is the error doesn’t occur on default locale (en), It only occur when I use other locales (tested zh and vi locale).

Please see debug images below for more information because it really hard to be describe by comment.

Screen Shot 2020-09-19 at 16 33 00 Screen Shot 2020-09-19 at 16 24 03

Thank you so much for a great library ever.

Expected behavior The error t is not a function shouldn’t fired

Information

  • Day.js Version 1.8.36
  • OS: MacOs
  • Browser: chrome 85
  • Time zone: GMT+07:00
  • Locale used for test: zh and vi

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iamkuncommented, Sep 20, 2020

I’m afraid I can not reproduce this on my computer. A demo repo provided will be better.

0reactions
iamkuncommented, Oct 11, 2020

Cheers~

Read more comments on GitHub >

github_iconTop Results From Across the Web

Starting the week on Monday with isoWeekday()
Just update, that new release requires doy (First day of the year) as well. It worked for me, thanks. – Paulo Guimarães. Nov...
Read more >
Listing the months and weekdays of the current Moment.js locale
If true, the weekdays will be returned in locale specific order. For instance, in the Arabic locale, Saturday is the first day of...
Read more >
The Weekday and Calendar functions in Power Apps
Changing the day headings above the Calendar is easy. Just replace Calendar.WeekdaysShort() with the following:
Read more >
Day of Week (Locale Aware)
Gets or sets the day of the week according to the locale. This dependent on Weekday plugin to work. If the locale assigns...
Read more >
Docs - Moment.js
Day.js is designed to be a minimalist replacement for Moment.js, ... To get the current date and time, just call moment() with no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found