iamkun / iamkun/dayjs

Integrate dayjs locales into custom library

Open
#1,959 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Hi there,

currently we are developing a library which should provide us the opportunity to encapsulate all date and theme specific parts.
This is the specific part in the library code. The LocalizationProvider is a material-ui component.
```
const translateLocale = (): string | undefined => {
if (locale.startsWith('en'))
return 'en'
if (locale.startsWith('de'))
return 'de'
if (locale.startsWith('cs'))
return 'cs'
}

{children}

```

But unfortunately we have to import the dayjs locales in all projects that are using our library. Currently it is not possible to import the locales in the library.
```
import 'dayjs/locale/de'
import 'dayjs/locale/en'
import 'dayjs/locale/cs'
```

Is there any way to integrate the dayjs library/locales with rollup into the library in such a way, that we don't have to import locales in projects that are using our library?

Thank you a lot,

Simon

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the Rollup configuration and the dayjs locale imports shown in the issue, along with how LocalizationProvider passes adapterLocale. Determine whether the package can include these locales without consumer imports, and verify that the supported en, de, and cs locales work from consuming projects.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, localization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.