Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateHelperService.parseTime('4:00') returns time as '00:00:00' #4775

Closed
altso opened this issue Feb 12, 2020 · 0 comments · Fixed by #4949
Closed

DateHelperService.parseTime('4:00') returns time as '00:00:00' #4775

altso opened this issue Feb 12, 2020 · 0 comments · Fixed by #4949

Comments

@altso
Copy link

altso commented Feb 12, 2020

Reproduction link

https://stackblitz.com/edit/ng-zorro-antd-start-ewrzkm

Steps to reproduce

  fdescribe('ParseTime', () => {
    beforeEach(() => {
      injector = TestBed.configureTestingModule({
        imports: [NzI18nModule]
      });

      dateHelper = injector.get(DateHelperService);
    });

    it('should parse custom time', () => {
      expect(dateHelper.parseTime('14:00')?.toTimeString().substr(0, 8)).toBe('14:00:00'); -- passes
      expect(dateHelper.parseTime('4:00')?.toTimeString().substr(0, 8)).toBe('04:00:00'); -- fails
    });
  });

What is expected?

dateHelper.parseTime('4:00') to return 04:00

What is actually happening?

dateHelper.parseTime('4:00') returns 00:00

Environment Info
ng-zorro-antd 8.5.2
Browser Chrome

This affects the functionality of time picker. If you enter '4:00' without leading zero manually, it will reset to '00:00' on blur.

Please see the tests here: altso@50cd9d9

hsuanxyz pushed a commit that referenced this issue Apr 1, 2020
* fix(module:time-picker): allow inputting string type

Fixes #4775, Fixes #4777, Fixed #4871, close #1679
Ricbet pushed a commit to Ricbet/ng-zorro-antd that referenced this issue Apr 9, 2020
* fix(module:time-picker): allow inputting string type

Fixes NG-ZORRO#4775, Fixes NG-ZORRO#4777, Fixed NG-ZORRO#4871, close NG-ZORRO#1679
@hsuanxyz hsuanxyz mentioned this issue Apr 15, 2020
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
* fix(module:time-picker): allow inputting string type

Fixes NG-ZORRO#4775, Fixes NG-ZORRO#4777, Fixed NG-ZORRO#4871, close NG-ZORRO#1679
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants