add method
Implementation
JSTemporalPlainTime add(int hours, int minutes, int seconds, int ms) {
int h = hour + hours;
int m = minute + minutes;
int s = second + seconds;
int ms_ = millisecond + ms;
while (ms_ >= 1000) {
ms_ -= 1000;
s++;
}
while (ms_ < 0) {
ms_ += 1000;
s--;
}
while (s >= 60) {
s -= 60;
m++;
}
while (s < 0) {
s += 60;
m--;
}
while (m >= 60) {
m -= 60;
h++;
}
while (m < 0) {
m += 60;
h--;
}
while (h >= 24) {
h -= 24;
}
while (h < 0) {
h += 24;
}
return JSTemporalPlainTime(
hour: h,
minute: m,
second: s,
millisecond: ms_,
microsecond: microsecond,
nanosecond: nanosecond,
);
}