How can I resolve this issue? I'm attempting to log the elapsed and remaining time when reloading, but I keep encountering an error:
Error: Argument of type 'number' is not assignable to parameter of type 'string'.
The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type.
An argument for 'value' was not provided.
Below is the complete code sample:
LIST = [{
"id": "1lqgDs6cZdWBL",
"timeUpdated": "2020-04-22 12:51:23",
"status": "CLOSED"
}, {
"id": "C2Zl9JWfZHSJ",
"timeUpdated": "2020-04-22 12:51:07",
"status": "CLOSED"
}, {
"id": "BHbiVcCaQa2d"
"timeUpdated": "2020-04-15 14:53:12"
"status": "CLOSED"
}];
ngOnInit() {
this.initializeAlertTimer();
}
initializeAlertTimer(data?: any, duration?: any) {
const DURATION = duration < 0 ? 1000 : duration;
localStorage.setItem('DURATION', DURATION);
localStorage.setItem('start', Date.now());
const elapsed = Date.now() - localStorage.getItem('start');
const remaining = localStorage.setItem('DURATION')
setTimeout(() => {
}, DURATION)
addData() {
const data = {
"id": "qHFw59mujN9X",
"timeCreated": "2020-03-06 12:21:06",
"status": "NEW",
}
this.initializeAlertTimer(data, 20000);
}
In addition to resolving the errors above, my goal is to display the LIST data without repetition when opening or refreshing the application. Adding new data using addData() should trigger initializeAlertTimer() to display the latest information.