Closed celsoagra closed 8 years ago
Let me see,
Based on the existing code, https://github.com/ng2-ui/ng2-datetime-picker/blob/master/src/datetime.ts#L54
Yes, it's possible. If not, let me know. I will treat it as a bug.
@celsoagra if you made it successful, please attach your screenshot here, so that other people can see it. A picture is better than thousand words.
@allenhwkim Thanks for you answer! Sorry to not give you a feedback. I was quite on a rush here.
I tried to change the datetime.ts file, but now I get a new error. I think I did something wrong here.
I create a new folder with same content that ng2-datetime-picker/src files:
+-- ng2-datetime-picker
| +-- datetime.ts
| +-- datetime-picker.component.ts
| +-- datetime-picker.directive.ts
| +-- index.ts
Then I changed the "datetime.ts", as you suggested above (initialize method #17).
Then I set this in my app,module.ts:
import { NgModule } from '@angular/core';
import { Ng2DatetimePickerModule } from './shared/ng2-datetime-picker';
// ....
@NgModule({
imports: [
// ....
Ng2DatetimePickerModule
],
// ....
})
export class AppModule {
}
But now I get a new error:
Error: Error: XHR error (404 Not Found) loading http://XXXX/build/shared/ng2-datetime-picker.js(…)
I have a "build" folder to store only the "compiled" files.
Could you help me please?
@allenhwkim is there a way to change datetime.ts and use this in node-modules?
import { Ng2DatetimePickerModule } from 'ng2-datetime-picker';
will work to use node_modules.
Please take a look at the plunker example which uses node_modules.
About the name of months, you simply set Moment js setting. You don't need any change on datetime-picker. Please take a look at the following example. By simply adding these lines, you can change 'months' and 'days' to your locale.
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js"></script>
<script> moment.locale('fr'); </script>
Solved!!
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment-with-locales.min.js"></script>
<script> moment.locale('pt-br'); </script>
I just add this to my index.html and the moment works fine
Thanks again for your help!
My pleasure to help. Glad to hear it worked
Hi,
I have a question about i18n. I saw that you're using momentJS with locale, so I'd like to know if it is possible to change language to use 'PT-BR'?
Is it possible?