xtianus79 / multiple-date-picker-angular

Multiple Date Picker for Angular: This includes Angular 2+ / 4+ / 5+ to utilize a lightweight and clean calendar allowing user to select multiple dates, single, use custom callback on (de)selection. You can also specify off days or already selected days. You can also select a range of dates with start and end inputs... This will also calculate all the days inbetween.
http://xtianus79.github.io/MultipleDatePicker
MIT License
14 stars 19 forks source link

no effect of moment.locale('ja') #22

Open hryktrd opened 4 years ago

hryktrd commented 4 years ago

Hi.

I use multiple-date-picker-angular on angular8 project. I want to change language to japanese day and month letter.

But, I wrote this in component that use date picker

import * as moment from 'moment';
import 'moment/locale/ja';
moment.locale('ja');

it have no effect.

And then, I wrote this in dist/multiple-date-picker.component.js directly,

var moment = require("moment/moment");
moment.locale('ja');

under require moment. letters of month and day are changed to japanese.

Any other way to change locale?

Thank you.

anarushka commented 4 years ago

Hi, Have you tried setting locale at your app level instead of a specific component?

hryktrd commented 4 years ago

I tried setting locale at app.component.ts by receiving your message, but it still don't change to Japanese. image

my import section in app.component is follows

import { AmplifyService } from 'aws-amplify-angular';
import * as moment from 'moment';
import 'moment/locale/ja';
moment.locale('ja');

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})

Thank you.

balgopal14 commented 4 years ago

Hi, Have slimier problem so i fork and added the locale support feature.

hryktrd commented 4 years ago

@balgopal14 Hi, Do you have repository that soluted this problem? I saw your profile but I couldn't find your repository that forked from this repository. Do you have it in private repository? If you can share source code, could you show me it?

Thank you.

hryktrd commented 4 years ago

@balgopal14 Sorry, I was overlooking your pull request. I'll try to change locale by using your repository. https://github.com/habilelabs/multiple-date-picker-angular

Thank you.

balgopal14 commented 4 years ago

@hryktrd Just set the locale parameter in multi-date-picker like this <multiple-date-picker [locale]="locale"> It will change the language of date picker.

hryktrd commented 4 years ago

@balgopal14 Thank you, very much.

When I tried it, I could change the locale to ja, but I could change the locale only on the day of the week. Do you know how to change the month locale?

image

balgopal14 commented 4 years ago

Hi @hryktrd, It changing the locale of month as well in my end. Could you please try to check this on page reload.

hryktrd commented 4 years ago

Hi. @balgopal14 I tried to clear cache and page reload, but month's locale didn't change to japanese. Which locale do you use? I'll try to use locale same.

And my usage is follows

<multiple-date-picker
      [(ngModel)]="holidays"
      [fontAwesome]="true"
      [disableDaysBefore]="true"
      [disallowBackPastMonths]="true"
      [sundayFirstDay]="true"
      locale="ja"
    ></multiple-date-picker>

Thank you.

balgopal14 commented 4 years ago

Hi, @hryktrd

image

I used this as a dynamic feature. screenshot is from "sv-SE" locale

hryktrd commented 4 years ago

Hi, @balgopal14 I tried locale that same as you, but month's locale didn't change...

image

I couldn't under stand that your part of comment 'dynamic feature'. What's mean of it? And your screenshot looks like different from my screen. I use multiple-date-picker by default design. Are you using it by any customize?

Thank you.

hryktrd commented 4 years ago

Hi, @balgopal14

I'm sorry to ask you many questions

Do you have any idea to change locale of name of month?

Thank you.

hryktrd commented 4 years ago

Hi, @balgopal14 I solute this problem by fix locale to japanese only.

In your code,

moment.locale(this.locale || 'en-US') //dynamic locale

is not effective to month's format, so I move it to under of

import * as moment from 'moment/moment';

but this.locale is undefined here, so I fix locale to 'ja'. https://github.com/hryktrd/multiple-date-picker-angular

I'd be happy if the locale could be dynamically set to include the month, but I think a big change is needed.

Thank you.

balgopal14 commented 4 years ago

Hi, @hryktrd Yes right a big change is needed for month. I'm not sure why but somehow its working on my end.

Thank you.