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

[FeatureRequest] Support nullable times #311

Closed
DavideDelbianco opened this issue Mar 23, 2020 · 11 comments
Closed

[FeatureRequest] Support nullable times #311

DavideDelbianco opened this issue Mar 23, 2020 · 11 comments

Comments

@DavideDelbianco
Copy link

When setting the timepicker value to null/undefined, instead of having the portion of code:

return parsedTime.toISOTime({
includeOffset: false,
suppressMilliseconds: true,
suppressSeconds: true
}).replace(/\u200E/g, '');

throw because cannot call .replace of "null" it would be nice to have the timepicker field reset to the placeholde "hh":"mm"

@DaanTul
Copy link

DaanTul commented Mar 24, 2020

This seems to be an issue with the 24h format only.

When closing the picker with 24 format enabled it throws this error. With the 12h format this does not seem to be a problem. Maybe it is a difference in the implementation of .toLocaleString vs .toISOTime ?

Edit: Looking at Luxon docs:

toLocaleString returns an object

whereas

toISOTime returns a string.

could this be the problem?

@DaanTul
Copy link

DaanTul commented Mar 24, 2020

I traced the problem to setting the default time when closing the picker when the format is 24h. I am however not sure why this occurs only for the 24h format.

@DaanTul
Copy link

DaanTul commented Mar 24, 2020

This bug is also present on the demo page

@Agranom
Copy link
Owner

Agranom commented Mar 24, 2020

@Nephyron which version do you use?

@Silureth
Copy link

Hey! I have the same issue, with the new version 5.4.3.
On my office computer it still has 5.3.0 and with that it works.

Agranom added a commit that referenced this issue Mar 26, 2020
* issue184: ! fix setting time without interaction with clock face

* issue184: + add min and max time range

* issue184: * move logic from defaultTime to updateTime

* issue184: + condition to disable period selection

* issue184: * change time after period changes

* issue311: ! fix error that shows after closing timepicker without time changed in 24 format

* issue184: ! prevent calling disableMinutes if selected hour is not provided

* * update readme, changelog and version
@Agranom
Copy link
Owner

Agranom commented Mar 26, 2020

Fixed in v5.5.0

@Agranom Agranom closed this as completed Mar 27, 2020
@Borizzio
Copy link

Borizzio commented May 7, 2020

Hello,
The problem persist in v5.5.1 but works in v5.5.0 !

@vignesh-balaguru
Copy link

Hi,
I have installed ngx-material-timepicker v5.5.0. While I run "ng build --watch" command, I'm getting this kind of error is shown below.

ERROR in ../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/ngx-material-timepicker-container/ngx-material-timepicker-container.component.d.ts:45:9 - error TS1086: An accessor cannot be declared in an ambient context.

45 set defaultTime(time: string);
~~~~~~~~~~~
../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/ngx-material-timepicker-container/ngx-material-timepicker-container.component.d.ts:46:9 - error TS1086: An accessor cannot be declared in an ambient context.

46 get defaultTime(): string;
~~~~~~~~~~~
../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/timepicker-dial-control/ngx-material-timepicker-dial-control.component.d.ts:20:17 - error TS1086: An accessor cannot be declared in an ambient context.

20 private get selectedTime();
~~~~~~~~~~~~
../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/timepicker-field/ngx-timepicker-field.component.d.ts:31:9 - error TS1086: An accessor cannot be declared in an ambient context.

31 set format(value: number);
~~~~~~
../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/timepicker-field/ngx-timepicker-field.component.d.ts:32:9 - error TS1086: An accessor cannot be declared in an ambient context.

32 get format(): number;
~~~~~~
../node_modules/ngx-material-timepicker/src/app/material-timepicker/components/timepicker-field/ngx-timepicker-field.component.d.ts:33:9 - error TS1086: An accessor cannot be declared in an ambient context.

33 set min(value: string | DateTime);

How can I proceed further? Please let me know if you have any solution for this.

@Agranom
Copy link
Owner

Agranom commented May 15, 2020

@vignesh-balaguru use the latest version of the timepicker

@vignesh-balaguru
Copy link

Hi Agranom,
While i am using the latest version of ngx-timepicker v5.5.2. I am getting error in this console is:

image

@jbarros35
Copy link

Do you guys know some workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants