bootstrap-datepicker icon indicating copy to clipboard operation
bootstrap-datepicker copied to clipboard

#2699 month name to number

Open marijusGood opened this issue 1 year ago • 2 comments

Q A
Bug fix? no
New feature? yes
BC breaks? no
Related tickets https://github.com/uxsolutions/bootstrap-datepicker/issues/2699
License MIT

marijusGood avatar Jun 07 '24 07:06 marijusGood

This is something that we require, is there any progress on this being completed?

PopeyeDevelopment avatar Jan 06 '25 15:01 PopeyeDevelopment

This is something that we require, is there any progress on this being completed?

Hey, We have forked this repo and created our own solution. The feature to solve month name to number is here: https://github.com/marijusGood/bootstrap-datepicker/blob/83caeeeb1161fccbbdf259cd0874483ce3484081/dist/js/bootstrap-datepicker.js#L2018

I've added a new monthNameToNumber value that is False on default but if you specify it to be true just like any other parameter it will convert Feb feb February february to 2

hope this helps, let me know if you have more questions

PS: you can ignore afterInputChange that is something that we needed

most important line is:

if (isNaN(val)){
  if (part === 'mm' && monthNameToNumber) {
	  filtered = $(dates[language].monthsShort).filter(match_part);
	  if (filtered[0] !== undefined) {
		  val = $.inArray(filtered[0], dates[language].monthsShort) + 1;

marijusGood avatar Jan 06 '25 16:01 marijusGood