md2 icon indicating copy to clipboard operation
md2 copied to clipboard

[datepicker-BUG] Datepicker auto -1 month when use format properties

Open DE-TriNguyen opened this issue 8 years ago • 3 comments

Bug, feature request, or proposal:

BUG : Datepicker auto -1 month when use format properties

What is the expected behavior?

Datepicker don't auto -1 month when use format properties

What is the current behavior?

BUG : Datepicker auto -1 month when use format properties

What are the steps to reproduce?

Providing a Plunker (or similar) is the best way to get the team to see your issue. Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info

  1. Go to : http://code.promactinfo.com/md2/#/datepicker
  2. Choose
  • Picker Type : Month
  • Source format : Poland
  • Stick Open on focus
  • Bug show up ! it's auto -1 value of month when Datepicker show up

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, MD2, OS, browsers are affected?

Angular 2, Chrome

Is there anything else we should know?

I found ur Md2Datepicker.prototype._handleBlur() make this happen

DE-TriNguyen avatar Sep 07 '17 04:09 DE-TriNguyen

Workaround :

import { Md2Datepicker } from 'md2'; Md2Datepicker.prototype._handleBlur = function (event) { return; };

and it's working like a charm

DE-TriNguyen avatar Sep 07 '17 07:09 DE-TriNguyen

@DE-TriNguyen Unfortunately, this approach still makes the "md2-datepicker-input-focused" class remain. I'm also struggling with it... 😢

DE-Kato avatar Sep 19 '17 06:09 DE-Kato

i suggest you ->


(DateUtil.prototype as any).createDate = (year, month, date, hours, minutes, seconds) => {
  let ret = new Date(year, month, date, hours, minutes, seconds);
  return ret.getMonth() == month ? ret : new Date(year, month + 1, 0, hours, minutes, seconds);
}

Mfron-42 avatar Feb 01 '18 04:02 Mfron-42