Repository: iamkun/dayjs (JavaScript)

Issue:
Localisation issues in `sk.js` (Slovak)
Related #302 #4

---

There are some issues in [`sk.js`](https://github.com/iamkun/dayjs/blob/dev/src/locale/sk.js):
- ```ordinal: n => `${n}º`,``` → ```ordinal: n => `${n}.`,```:
   - there should a dot after ordinal numbers;
- `L: 'DD.MM.YYYY',` → `L: 'DD. MM. YYYY',`:
   - according to [STN 01  6910 (in Slovak)](http://www.tezaurus.sk/stn_01_6910.pdf), the spaces after each dot in the date is prefered, but the spaces can be omitted, therefore this is not an issue _per se_;
- `weekdays: 'Nedeľa_Pondelok_Utorok_Streda_Štvrtok_Piatok_Sobota'.split('_'),` → `weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),`
- `weekdaysShort: 'Ne_Po_Ut_St_Št_Pi_So'.split('_'),` → `weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),`.

Then there is as an issue with the the numbers of and declension of the nouns (see also #302). The grammatical rules in Slovak are quite similar to those in [Czech](https://github.com/iamkun/dayjs/blob/dev/src/locale/cs.js), therefore I have just copied the `plural()` and `translate()` functions from there and replaced the nouns with the Slovak ones. I would open a PR with this, but I am not a good coder, therefore this must be reviewed.

All in all, here is the proposed content of `sk.js`. I hope I did not made any mistakes. I have added some comments to make it easier to check if the words are really those that should be assigned to the particular key.

<details>
   <summary><code>sk.js</code></summary>

```js
// Slovak [sk]
import dayjs from 'dayjs'

function plural(n) {
  return (n > 1) && (n < 5) && (~~(n / 10) !== 1) // eslint-disable-line
}

/* eslint-disable */ 
function translate(number, withoutSuffix, key, isFuture) {
  const result = `${number} `
  switch (key) {
    case 's': // a few seconds / in a few seconds / a few seconds ago
      // in a few seconds / a few seconds ago
      return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'
    case 'm': // a minute / in a minute / a minute ago
      return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou')
    case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
      if (withoutSuffix || isFuture) {
        // 2-4 minutes / 5+ minutes
        return result + (plural(number) ? 'minúty' : 'minút')
      }
      // 2+ minutes ago
      return `${result}minútami`
    case 'h': // an hour / in an hour / an hour ago
      return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou')
    case 'hh': // 9 hours / in 9 hours / 9 hours ago
      if (withoutSuffix || isFuture) {
        // 2-4 hours / 5+ hours
        return result + (plural(number) ? 'hodiny' : 'hodín')
      }
      // 2+ hours ago
      return `${result}hodinami`
    case 'd': // a day / in a day / a day ago
      // in a day / a day ago
      return (withoutSuffix || isFuture) ? 'deň' : 'dňom'
    case 'dd': // 9 days / in 9 days / 9 days ago
      if (withoutSuffix || isFuture) {
        // 2-4 days / 5+ days
        return result + (plural(number) ? 'dni' : 'dní')
      }
      // 2+ days ago
      return `${result}dny`
    case 'M': // a month / in a month / a month ago
      // in a month / a month ago
      return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'
    case 'MM': // 9 months / in 9 months / 9 months ago
      if (withoutSuffix || isFuture) {
        // 2-4 months / 5+ months
        return result + (plural(number) ? 'mesiace' : 'mesiacov')
      }
      // 2+ months ago
      return `${result}mesiacmi`
    case 'y': // a year / in a year / a year ago
      // in a year / a year ago
      return (withoutSuffix || isFuture) ? 'rok' : 'rokom'
    case 'yy': // 9 years / in 9 years / 9 years ago
      if (withoutSuffix || isFuture) {
        // 2-4 years / 5+ years
        return result + (plural(number) ? 'roky' : 'rokov')
      }
      // 2+ year ago
      return `${result}rokmi`
  }
}
/* eslint-enable */

const locale = {
  name: 'sk',
  weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
  weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
  weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
  months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
  monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'),
  weekStart: 1,
  relativeTime: {
    future: 'o %s',
    past: 'pred %s',
    s: 'niekoľko sekúnd',
    m: 'minúta',
    mm: '%d minút',
    h: 'hodina',
    hh: '%d hodín',
    d: 'deň',
    dd: '%d dní',
    M: 'mesiac',
    MM: '%d mesiacov',
    y: 'rok',
    yy: '%d rokov'
  },
  ordinal: n => `${n}.`,
  formats: {
    LT: 'H:mm',
    LTS: 'H:mm:ss',
    L: 'DD. MM. YYYY',
    LL: 'D. MMMM YYYY',
    LLL: 'D. MMMM YYYY H:mm',
    LLLL: 'dddd D. MMMM YYYY H:mm'
  }
}

dayjs.locale(locale, null, true)

export default locale
```
</details>

---

PS—@prantlf, can I ask you to check the `translate()` function? Thanks in advance! :smiley:


Hints:
Thanks. 

It will be great if you could send us a PR to fix this. 

And there will be a patch release this weekend.

> plus, I'd like to keep `L: 'DD.MM.YYYY'` the same as moment.js and not to change it.
Okay, I’ll tend it now.

> plus, I'd like to keep `L: 'DD.MM.YYYY'` the same as moment.js and not to change it.

Okay, I accept that. However, can’t we add another variable (or whatever you call it, like the `L`) for `DD. MM. YYYY`?
You can use https://day.js.org/docs/en/plugin/update-locale to suit your need in your project easily/
Thanks. Laste question: should I open a PR against the `dev` branch?
Yes, from the dev branch, please. 

And you can check test/locale/cs.test.js as a reference to make the test pass with 100% coverage.
> And you can check `test/locale/cs.test.js` as a reference to make the test pass with 100% coverage.

I’ll do my best.

---

I [`cs.test.js`](https://github.com/tukusejssirs/dayjs/blob/dev/test/locale/cs.test.js), the following constant has some comments which might need some corrections. I know that the comments mean nothing to `dayjs` nor `moment`, therefore the test still passes, but I think the comments should be fixed.

What do you think?

```js
  const T = [
    [44.4, 'second'], // a few seconds  ← Are `44.4s` considered _a few seconds_?
    [89.5, 'second'], // a minute       ← Are `89.5s` seconds _a minute_?
    // ...
    [43, 'minute'], // 44 minutes       ← I don’t think that `43` = `44`.
    [45, 'minute'], // an hour          ← I don’t think that `45m` = `1h`.
    // ...
    [18, 'month'] // 2 years            ← I don’t think that `18mo` = `2y`.
  ]
```
Ha, that's the relative time result in English. And 44 minutes  -> should be 43 minutes.

Fell free to fix it if you like 😁 
Okay. Just to confirm: **only** `44 minutes` should be changed to `43 minutes`, other constants are treated as relative time, correct?
Yes, cheers. You can skip these comments in your test file if you like.
ref2 https://github.com/moment/moment/blob/develop/locale/sk.js
I see. In order to fix `dayjs` I need to fix `moment`. :weary:
Anyway, does `dayjs` support the setting of the first day of week? See below the snippet from `moment`’ `sk.js`.

```js
        week : {
            dow : 1, // Monday is the first day of the week.
            doy : 4  // The week that contains Jan 4th is the first week of the year.
        }
```
I have open moment/moment#5408 issue and created moment/moment#5409 PR, but there are some Travis issues I could not fix.
Yes, https://day.js.org/docs/en/customization/customization weekStart, yearStart
Plus, how about we just keep the same result as moment.js at first, to get CI passed with 100% coverage, and release it in this week.

After that, we could keep fixing this minor error. 
And you can run `npm test` to see test status and coverage easily.
```js
  yearStart: 4, // OPTIONAL, the week that contains Jan 4th is the first week of the year.
```

Is `4` the default? The ISO week numbering is used in Slovakia, therefore if `4` is default, then no change is needed in here, otherwise I’d add it to `sk.js`.
<del>I'll update this to make `yearStart 4` default in this version, too. So, no change needed.</del>
I have run `npm test` which the changed value, but the following test does not pass:

```bash
 FAIL  test/plugin/utc-utcOffset.test.js
  ● utc startOf

    expect(received).toBe(expected) // Object.is equality
    
    Expected value to be:
      1568213999999
    Received:
      1568217599999

      94 |   expect(moment(d).utc().utcOffset(480).endOf('day')
      95 |     .valueOf())
    > 96 |     .toBe(dayjs(d).utc().utcOffset(480).endOf('day')
      97 |       .valueOf())
      98 | 
      99 |   expect(moment(d).utc().utcOffset(480).endOf('day')
      
      at Object.<anonymous> (test/plugin/utc-utcOffset.test.js:96:6)
```
Please add `yearStart 4`, sorry for my previous reply.
wired 😬 
And now, when I wanted to fix another l10n (I have missed translating `dny` to `dňami`), I cannot commit:

```bash
$ git commit -am 'Fix `dny` issue'

/home/ts/git/c10n/dayjs/src/index.js
  1:20  error  Missing file extension "js" for "./constant"   import/extensions
  2:15  error  Missing file extension "js" for "./utils"      import/extensions
  3:16  error  Missing file extension "js" for "./locale/en"  import/extensions

/home/ts/git/c10n/dayjs/src/locale/sk.js
  71:23  error  Multiple spaces found before '// Should be `...'  no-multi-spaces

/home/ts/git/c10n/dayjs/src/plugin/advancedFormat/index.js
  1:32  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/buddhistEra/index.js
  1:32  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/isoWeek/index.js
  1:25  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/localizedFormat/index.js
  1:32  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/quarterOfYear/index.js
  1:25  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/relativeTime/index.js
  1:20  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/utc/index.js
  1:44  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/plugin/weekOfYear/index.js
  1:29  error  Missing file extension "js" for "../../constant"  import/extensions

/home/ts/git/c10n/dayjs/src/utils.js
  1:20  error  Missing file extension "js" for "./constant"  import/extensions

/home/ts/git/c10n/dayjs/test/comparison.test.js
  2:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/constructor.test.js
  2:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/display.test.js
  3:19  error  Missing file extension "js" for "../src"            import/extensions
  4:16  error  Missing file extension "js" for "../src/locale/th"  import/extensions
  5:8   error  Missing file extension "js" for "../src/locale/ja"  import/extensions

/home/ts/git/c10n/dayjs/test/get-set.test.js
  3:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/locale/cs.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/cs"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/et.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/et"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/fi.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/fi"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/keys.test.js
  3:19  error  Missing file extension "js" for "../../src"  import/extensions

/home/ts/git/c10n/dayjs/test/locale/pl.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/pl"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/ru.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/ru"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/sk.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/sk"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/sv.test.js
  2:19  error  Missing file extension "js" for "../../src"                        import/extensions
  3:28  error  Missing file extension "js" for "../../src/plugin/advancedFormat"  import/extensions
  4:8   error  Missing file extension "js" for "../../src/locale/sv"              import/extensions

/home/ts/git/c10n/dayjs/test/locale/uk.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/uk"            import/extensions

/home/ts/git/c10n/dayjs/test/locale/zh-cn.test.js
  3:19  error  Missing file extension "js" for "../../src"               import/extensions
  4:8   error  Missing file extension "js" for "../../src/locale/zh-cn"  import/extensions

/home/ts/git/c10n/dayjs/test/locale/zh.test.js
  1:19  error  Missing file extension "js" for "../../src"                        import/extensions
  2:28  error  Missing file extension "js" for "../../src/plugin/advancedFormat"  import/extensions
  3:24  error  Missing file extension "js" for "../../src/plugin/weekOfYear"      import/extensions

/home/ts/git/c10n/dayjs/test/locale.test.js
  3:19  error  Missing file extension "js" for "../src"            import/extensions
  4:16  error  Missing file extension "js" for "../src/locale/es"  import/extensions

/home/ts/git/c10n/dayjs/test/manipulate.test.js
  3:19  error  Missing file extension "js" for "../src"               import/extensions
  4:8   error  Missing file extension "js" for "../src/locale/zh-cn"  import/extensions
  5:8   error  Missing file extension "js" for "../src/locale/ar"     import/extensions

/home/ts/git/c10n/dayjs/test/parse.test.js
  3:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/advancedFormat.test.js
  3:19  error  Missing file extension "js" for "../../src"                        import/extensions
  4:28  error  Missing file extension "js" for "../../src/plugin/advancedFormat"  import/extensions
  5:24  error  Missing file extension "js" for "../../src/plugin/weekOfYear"      import/extensions
  6:22  error  Missing file extension "js" for "../../src/plugin/weekYear"        import/extensions
  7:8   error  Missing file extension "js" for "../../src/locale/zh-cn"           import/extensions

/home/ts/git/c10n/dayjs/test/plugin/badMutable.test.js
  3:19  error  Missing file extension "js" for "../../src"                    import/extensions
  4:24  error  Missing file extension "js" for "../../src/plugin/badMutable"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/zh-cn"       import/extensions

/home/ts/git/c10n/dayjs/test/plugin/buddhistEra.test.js
  3:19  error  Missing file extension "js" for "../../src"                     import/extensions
  4:25  error  Missing file extension "js" for "../../src/plugin/buddhistEra"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/calendar.test.js
  3:19  error  Missing file extension "js" for "../../src"                  import/extensions
  4:22  error  Missing file extension "js" for "../../src/plugin/calendar"  import/extensions
  5:18  error  Missing file extension "js" for "../../src/locale/zh-cn"     import/extensions

/home/ts/git/c10n/dayjs/test/plugin/customParseFormat.test.js
  3:19  error  Missing file extension "js" for "../../src"                           import/extensions
  4:31  error  Missing file extension "js" for "../../src/plugin/customParseFormat"  import/extensions
  5:16  error  Missing file extension "js" for "../../src/locale/uk"                 import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/zh-cn"              import/extensions

/home/ts/git/c10n/dayjs/test/plugin/dayOfYear.test.js
  3:19  error  Missing file extension "js" for "../../src"                   import/extensions
  4:23  error  Missing file extension "js" for "../../src/plugin/dayOfYear"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isBetween.test.js
  2:19  error  Missing file extension "js" for "../../src/index"                   import/extensions
  3:23  error  Missing file extension "js" for "../../src/plugin/isBetween/index"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isLeapYear.test.js
  2:19  error  Missing file extension "js" for "../../src"                    import/extensions
  3:24  error  Missing file extension "js" for "../../src/plugin/isLeapYear"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isMoment.test.js
  2:19  error  Missing file extension "js" for "../../src"                  import/extensions
  3:22  error  Missing file extension "js" for "../../src/plugin/isMoment"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isoWeek.test.js
  3:19  error  Missing file extension "js" for "../../src"                 import/extensions
  4:21  error  Missing file extension "js" for "../../src/plugin/isoWeek"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isoWeeksInYear.test.js
  2:19  error  Missing file extension "js" for "../../src"                        import/extensions
  3:28  error  Missing file extension "js" for "../../src/plugin/isoWeeksInYear"  import/extensions
  4:24  error  Missing file extension "js" for "../../src/plugin/isLeapYear"      import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isSameOrAfter.test.js
  2:19  error  Missing file extension "js" for "../../src"                       import/extensions
  3:27  error  Missing file extension "js" for "../../src/plugin/isSameOrAfter"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/isSameOrBefore.test.js
  2:19  error  Missing file extension "js" for "../../src"                        import/extensions
  3:28  error  Missing file extension "js" for "../../src/plugin/isSameOrBefore"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/localeData.test.js
  3:19  error  Missing file extension "js" for "../../src"                         import/extensions
  4:24  error  Missing file extension "js" for "../../src/plugin/localeData"       import/extensions
  5:29  error  Missing file extension "js" for "../../src/plugin/localizedFormat"  import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/zh-cn"            import/extensions

/home/ts/git/c10n/dayjs/test/plugin/localizedFormat.test.js
  3:19  error  Missing file extension "js" for "../../src"                         import/extensions
  4:16  error  Missing file extension "js" for "../../src/locale/es"               import/extensions
  5:18  error  Missing file extension "js" for "../../src/locale/zh-cn"            import/extensions
  6:29  error  Missing file extension "js" for "../../src/plugin/localizedFormat"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/minMax.test.js
  2:19  error  Missing file extension "js" for "../../src"                import/extensions
  3:20  error  Missing file extension "js" for "../../src/plugin/minMax"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/quarterOfYear.test.js
  3:19  error  Missing file extension "js" for "../../src"                       import/extensions
  4:27  error  Missing file extension "js" for "../../src/plugin/quarterOfYear"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/relativeTime.test.js
  3:19  error  Missing file extension "js" for "../../src"                      import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/relativeTime"  import/extensions
  5:17  error  Missing file extension "js" for "../../src/plugin/utc"           import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/ru"            import/extensions

/home/ts/git/c10n/dayjs/test/plugin/toArray.test.js
  3:19  error  Missing file extension "js" for "../../src"                 import/extensions
  4:21  error  Missing file extension "js" for "../../src/plugin/toArray"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/toObject.test.js
  3:19  error  Missing file extension "js" for "../../src"                  import/extensions
  4:22  error  Missing file extension "js" for "../../src/plugin/toObject"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/updateLocale.test.js
  3:19  error  Missing file extension "js" for "../../src"                         import/extensions
  4:26  error  Missing file extension "js" for "../../src/plugin/updateLocale"     import/extensions
  5:29  error  Missing file extension "js" for "../../src/plugin/localizedFormat"  import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/zh-cn"            import/extensions

/home/ts/git/c10n/dayjs/test/plugin/utc-utcOffset.test.js
  3:19  error  Missing file extension "js" for "../../src"             import/extensions
  4:17  error  Missing file extension "js" for "../../src/plugin/utc"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/utc.test.js
  3:19  error  Missing file extension "js" for "../../src"                           import/extensions
  4:17  error  Missing file extension "js" for "../../src/plugin/utc"                import/extensions
  5:31  error  Missing file extension "js" for "../../src/plugin/customParseFormat"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin/weekday.test.js
  3:19  error  Missing file extension "js" for "../../src"                 import/extensions
  4:21  error  Missing file extension "js" for "../../src/plugin/weekday"  import/extensions
  5:8   error  Missing file extension "js" for "../../src/locale/zh-cn"    import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/ar"       import/extensions

/home/ts/git/c10n/dayjs/test/plugin/weekOfYear.test.js
  3:19  error  Missing file extension "js" for "../../src"                        import/extensions
  4:24  error  Missing file extension "js" for "../../src/plugin/weekOfYear"      import/extensions
  5:28  error  Missing file extension "js" for "../../src/plugin/advancedFormat"  import/extensions
  6:8   error  Missing file extension "js" for "../../src/locale/en-gb"           import/extensions

/home/ts/git/c10n/dayjs/test/plugin/weekYear.test.js
  3:19  error  Missing file extension "js" for "../../src"                    import/extensions
  4:22  error  Missing file extension "js" for "../../src/plugin/weekYear"    import/extensions
  5:24  error  Missing file extension "js" for "../../src/plugin/weekOfYear"  import/extensions

/home/ts/git/c10n/dayjs/test/plugin.test.js
  2:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/query.test.js
  2:19  error  Missing file extension "js" for "../src"  import/extensions

/home/ts/git/c10n/dayjs/test/timezone.test.js
  3:19  error  Missing file extension "js" for "../src"             import/extensions
  4:17  error  Missing file extension "js" for "../src/plugin/utc"  import/extensions

/home/ts/git/c10n/dayjs/test/utils.test.js
  1:19  error  Missing file extension "js" for "../src/utils"  import/extensions

✖ 134 problems (134 errors, 0 warnings)
  1 error, 0 warnings potentially fixable with the `--fix` option.

pre-commit: 
pre-commit: We've failed to pass the specified git pre-commit hooks as the `lint`
pre-commit: hook returned an exit code (1). If you're feeling adventurous you can
pre-commit: skip the git pre-commit hooks by adding the following flags to your commit:
pre-commit: 
pre-commit:   git commit -n (or --no-verify)
pre-commit: 
pre-commit: This is ill-advised since the commit is broken.
```
looks like your es-lint issue?
I run `npm install` in the repo root in order to make `npm test` work. Since then only, these errors started to pop out.

I’ve just run `npm install eslint`, it was updated, but the above-mentioned `git commit` error persists.

```bash
$ npm install eslint
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN rollup-plugin-babel@4.4.0 requires a peer of rollup@>=0.60.0 <3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ eslint@4.19.1
updated 1 package and audited 31231 packages in 23.842s

25 packages are looking for funding
  run `npm fund` for details

found 78 vulnerabilities (69 low, 8 moderate, 1 high)
  run `npm audit fix` to fix them, or `npm audit` for details
```

Patch:
diff --git a/src/locale/cs.js b/src/locale/cs.js
--- a/src/locale/cs.js
+++ b/src/locale/cs.js
@@ -56,6 +56,7 @@ const locale = {
   months: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split('_'),
   monthsShort: 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'),
   weekStart: 1,
+  yearStart: 4,
   ordinal: n => `${n}.`,
   formats: {
     LT: 'H:mm',
diff --git a/src/locale/sk.js b/src/locale/sk.js
--- a/src/locale/sk.js
+++ b/src/locale/sk.js
@@ -1,37 +1,87 @@
 // Slovak [sk]
 import dayjs from 'dayjs'
 
+function plural(n) {
+  return (n > 1) && (n < 5) && (~~(n / 10) !== 1) // eslint-disable-line
+}
+
+/* eslint-disable */
+function translate(number, withoutSuffix, key, isFuture) {
+  const result = `${number} `
+  switch (key) {
+    case 's': // a few seconds / in a few seconds / a few seconds ago
+      return (withoutSuffix || isFuture) ? 'pár sekúnd' : 'pár sekundami'
+    case 'm': // a minute / in a minute / a minute ago
+      return withoutSuffix ? 'minúta' : (isFuture ? 'minútu' : 'minútou')
+    case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
+      if (withoutSuffix || isFuture) {
+        return result + (plural(number) ? 'minúty' : 'minút')
+      }
+      return `${result}minútami`
+    case 'h': // an hour / in an hour / an hour ago
+      return withoutSuffix ? 'hodina' : (isFuture ? 'hodinu' : 'hodinou')
+    case 'hh': // 9 hours / in 9 hours / 9 hours ago
+      if (withoutSuffix || isFuture) {
+        return result + (plural(number) ? 'hodiny' : 'hodín')
+      }
+      return `${result}hodinami`
+    case 'd': // a day / in a day / a day ago
+      return (withoutSuffix || isFuture) ? 'deň' : 'dňom'
+    case 'dd': // 9 days / in 9 days / 9 days ago
+      if (withoutSuffix || isFuture) {
+        return result + (plural(number) ? 'dni' : 'dní')
+      }
+      return `${result}dňami`
+    case 'M': // a month / in a month / a month ago
+      return (withoutSuffix || isFuture) ? 'mesiac' : 'mesiacom'
+    case 'MM': // 9 months / in 9 months / 9 months ago
+      if (withoutSuffix || isFuture) {
+        return result + (plural(number) ? 'mesiace' : 'mesiacov')
+      }
+      return `${result}mesiacmi`
+    case 'y': // a year / in a year / a year ago
+      return (withoutSuffix || isFuture) ? 'rok' : 'rokom'
+    case 'yy': // 9 years / in 9 years / 9 years ago
+      if (withoutSuffix || isFuture) {
+        return result + (plural(number) ? 'roky' : 'rokov')
+      }
+      return `${result}rokmi`
+  }
+}
+/* eslint-enable */
 const locale = {
   name: 'sk',
-  weekdays: 'Nedeľa_Pondelok_Utorok_Streda_Štvrtok_Piatok_Sobota'.split('_'),
-  weekdaysShort: 'Ne_Po_Ut_St_Št_Pi_So'.split('_'),
+  weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
+  weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
   weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
   months: 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split('_'),
   monthsShort: 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_'),
   weekStart: 1,
-  relativeTime: {
-    future: 'o %s',
-    past: 'pred %s',
-    s: 'niekoľko sekúnd',
-    m: 'minúta',
-    mm: '%d minút',
-    h: 'hodina',
-    hh: '%d hodín',
-    d: 'deň',
-    dd: '%d dní',
-    M: 'mesiac',
-    MM: '%d mesiacov',
-    y: 'rok',
-    yy: '%d rokov'
-  },
-  ordinal: n => `${n}º`,
+  yearStart: 4,
+  ordinal: n => `${n}.`,
   formats: {
     LT: 'H:mm',
     LTS: 'H:mm:ss',
     L: 'DD.MM.YYYY',
     LL: 'D. MMMM YYYY',
     LLL: 'D. MMMM YYYY H:mm',
-    LLLL: 'dddd D. MMMM YYYY H:mm'
+    LLLL: 'dddd D. MMMM YYYY H:mm',
+    l: 'D. M. YYYY'
+  },
+  relativeTime: {
+    future: 'za %s', // Should be `o %s` (change when moment/moment#5408 is fixed)
+    past: 'pred %s',
+    s: translate,
+    m: translate,
+    mm: translate,
+    h: translate,
+    hh: translate,
+    d: translate,
+    dd: translate,
+    M: translate,
+    MM: translate,
+    y: translate,
+    yy: translate
   }
 }
 


Test patch:
diff --git a/test/locale/cs.test.js b/test/locale/cs.test.js
--- a/test/locale/cs.test.js
+++ b/test/locale/cs.test.js
@@ -19,7 +19,7 @@ it('RelativeTime: Time from X', () => {
     [44.4, 'second'], // a few seconds
     [89.5, 'second'], // a minute
     [2, 'minute'], // 2 minutes
-    [43, 'minute'], // 44 minutes
+    [43, 'minute'], // 43 minutes
     [45, 'minute'], // an hour
     [3, 'hour'], // 3 hours
     [21, 'hour'], // 21 hours
diff --git a/test/locale/sk.test.js b/test/locale/sk.test.js
new file mode 100644
--- /dev/null
+++ b/test/locale/sk.test.js
@@ -0,0 +1,52 @@
+import moment from 'moment'
+import MockDate from 'mockdate'
+import dayjs from '../../src'
+import relativeTime from '../../src/plugin/relativeTime'
+import '../../src/locale/sk'
+
+dayjs.extend(relativeTime)
+
+beforeEach(() => {
+  MockDate.set(new Date())
+})
+
+afterEach(() => {
+  MockDate.reset()
+})
+
+it('RelativeTime: Time from X', () => {
+  const T = [
+    [44.4, 'second'], // a few seconds
+    [89.5, 'second'], // a minute
+    [2, 'minute'], // 2 minutes
+    [43, 'minute'], // 43 minutes
+    [45, 'minute'], // an hour
+    [3, 'hour'], // 3 hours
+    [21, 'hour'], // 21 hours
+    [1, 'day'], // a day
+    [3, 'day'], // 3 day
+    [25, 'day'], // 25 days
+    [1, 'month'], // a month
+    [2, 'month'], // 2 month
+    [10, 'month'], // 10 month
+    [1, 'year'], // a year
+    [2, 'year'], // 2 year
+    [5, 'year'], // 5 year
+    [18, 'month'] // 2 years
+  ]
+
+  T.forEach((t) => {
+    dayjs.locale('sk')
+    moment.locale('sk')
+    const dayjsDay = dayjs()
+    const momentDay = moment()
+    const dayjsCompare = dayjs().add(t[0], t[1])
+    const momentCompare = moment().add(t[0], t[1])
+    expect(dayjsDay.from(dayjsCompare))
+      .toBe(momentDay.from(momentCompare))
+    expect(dayjsDay.to(dayjsCompare))
+      .toBe(momentDay.to(momentCompare))
+    expect(dayjsDay.from(dayjsCompare, true))
+      .toBe(momentDay.from(momentCompare, true))
+  })
+})