I\'d like for something like 5 + 6 to return \"56\" instead of 11.
I converted back to number like this..
const timeNow = '' + 12 + 45;
const openTime = parseInt(timeNow, 10);
output 1245
-- edit --
sorry,
for my use this still did not work for me after testing . I had to add the missing zero back in as it was being removed on numbers smaller than 10, my use is for letting code run at certain times May not be correct but it seems to work (so far).
h = new Date().getHours();
m = new Date().getMinutes();
isOpen: boolean;
timeNow = (this.m < 10) ? '' + this.h + 0 + this.m : '' + this.h + this.m;
openTime = parseInt(this.timeNow);
closed() {
(this.openTime >= 1450 && this.openTime <= 1830) ? this.isOpen = true :
this.isOpen = false;
(this.openTime >= 715 && this.openTime <= 915) ? this.isOpen = true :
this.isOpen = false;
}
The vote down was nice thank you :)
I am new to this and come here to learn from you guys an explanation of why would of been nice.
Anyways updated my code to show how i fixed my problem as this post helped me figure it out.