edcarroll / ng2-semantic-ui

Semantic UI Angular Integrations (no jQuery)
https://edcarroll.github.io/ng2-semantic-ui/
MIT License
615 stars 224 forks source link

feat(datepicker): Support semantic ui calendar options #165

Open trevordaniels opened 7 years ago

trevordaniels commented 7 years ago

Semantic UI Calendar has a number of useful config options that help it meet different use cases. Is it possible to get any or all of the following included?

monthFirst: true, // month before day when parsing/converting date from/to text initialDate: null, // date to display initially when no date is selected (null = now) startMode: false, // display mode to start in, can be 'year', 'month', 'day', 'hour', 'minute' (false = 'day') multiMonth: 1, // show multiple months when in 'day' mode

edcarroll commented 7 years ago

Going through each of these:

  1. You can control how the date appears by using the localization service, and for an individual datepicker you can put the month first with localeOverrides.
  2. Initial date is certainly something that can be easily added, at the moment it defaults to the current date.
  3. Start mode is definitely also possible, the calendar views are designed to be easily configured so that should be ok.
  4. I tried to get the Semantic UI Calendar jsbin to give me an example of this - are you able to set up a demo with that calendar so I can see it in action please?
trevordaniels commented 7 years ago

Thanks for looking at this. Here's a plunkr re 4. with multiple months working. I find this option useful only because the calendar by default disables previous and next month days when showing a month, making it misleading for users who think they cannot choose any dates beyond these. open issue

If its possible to enable those trailing/leading days that would be great too!

http://plnkr.co/edit/QscqlVfw0maq6cH2Ufa7

harogaston commented 7 years ago

Pending:

harogaston commented 7 years ago

@trevordaniels What do you mean exactly by monthFirst?

trevordaniels commented 7 years ago

@harogaston this setting allows switching the date format between mm/dd or dd/mm.

Ed's comments above suggest this can be handled through the localisation service. I haven't tested this yet.

harogaston commented 7 years ago

@trevordaniels Ok then. It should be possible now after this commit gets merged.

All in all only point 3 (aka start mode) is missing.