Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DxDateBox and use of globalize #52

Closed
StephanHartmann opened this issue Jul 22, 2016 · 3 comments
Closed

DxDateBox and use of globalize #52

StephanHartmann opened this issue Jul 22, 2016 · 3 comments
Assignees
Labels

Comments

@StephanHartmann
Copy link

Hello,

I want to use DxDateBox with a german date format DD.MM.YYYY set as displayformat.

As this didn't work out of box, I contacted DevExpress Support (we have a Universal Subscription).

They told me to include globalize. https://github.com/jquery/globalize

At the end it is working, but I'm not sure if I did it the best way ...

I installed it via

npm install globalize cldr-data --save

Afterwards I changed the following files

Angular-cli-build.js

vendorNpmFiles: [
  (...)
  'devextreme/dist/js/dx.all.js',
  'devextreme/dist/css/*.css',
  'devextreme/dist/css/icons/*.*',
  'devextreme-angular2/**/*.+(js|js.map)'    ,
  'ng2-bootstrap/**/*',
  'moment/min/**',
  'globalize/dist/**',                <----
  'cldrjs/dist/**'                    <----
]

system-config.js

const map: any = {
    'devextreme-angular2': 'vendor/devextreme-angular2',        
    moment: 'vendor/moment/min/moment.min.js',
    globalize: 'vendor/globalize/dist/globalize.js',     <----
    'symbol-observable': 'vendor/rxjs/node_modules/symbol-observable',
    'ng2-bootstrap': 'vendor/ng2-bootstrap',
};

/** User packages configuration. */
const packages: any = {
  'devextreme-angular2':        { main: 'index.js', defaultExtension: 'js' }, 
  'vendor/ng2-bootstrap': {        defaultExtension: 'js' },
  'symbol-observable': { main: 'index.js', defaultExtension: 'js' }    
};

Then I added the following to my index.html

<script type="text/javascript" src="vendor/cldrjs/dist/cldr.js"></script>
<script type="text/javascript" src="vendor/cldrjs/dist/cldr/event.js"></script>
<script type="text/javascript" src="vendor/cldrjs/dist/cldr/supplemental.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/number.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/currency.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/date.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/message.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/plural.js"></script>
<script type="text/javascript" src="vendor/globalize/dist/globalize/relative-time.js"></script>

Is there a better way of packaging?
at least the html looks ugly

@dxbykov
Copy link
Contributor

dxbykov commented Jul 22, 2016

Hi,

It looks like your question is related to issue #16. Once it is resolved, you'll be able to clear your index.html.

@GoshaFighten GoshaFighten self-assigned this Oct 21, 2016
@Angelminster
Copy link

#16 is closed, can you provide a code example in the documentation please?

@dxbykov
Copy link
Contributor

dxbykov commented Nov 30, 2016

Globalize requires a specific webpack configuration. At the same time, Angular CLI uses webpack internally but doesn't allow customizing its config file. We consider our new Intl integration to be a primary way of localizing your Angular 2 applications. If for some reason you want to use Globalize with webpack,, we have a sample, but it's not related to Angular CLI.

@dxbykov dxbykov closed this as completed Nov 30, 2016
marcwittke pushed a commit to marcwittke/devextreme-angular that referenced this issue Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants