Skip to content
This repository was archived by the owner on Jan 4, 2023. It is now read-only.

Commit 4aad85b

Browse files
committed
use milliseconds instead of seconds for timestamp
1 parent 69a83d2 commit 4aad85b

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

packages/uvalib-models/demo/uvalib-model-realtime-override.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6974,15 +6974,14 @@ class UvalibModelRealtimeOverride extends UvalibModelFBDB {
69746974
}
69756975

69766976
_checkTime(value) {
6977-
// see if we can parse the db value as a datetime
6978-
// var d = DateTime.fromISO(value);
6979-
var d = DateTime.fromSeconds(value);
6977+
// see if we can parse the db value as a datetime
6978+
var d = DateTime.fromMillis(value);
69806979

6981-
if (DateTime.local() < d) {
6980+
if (DateTime.local().toMillis() < d.toMillis()) {
69826981
// poll every few minutes to see if need to continue showing the override
69836982
this._adjustDom(this.defaultValue);
6984-
this._timeout = window.setTimeout(function(){this._checkTime(value);}.bind(this), 6000);
6985-
} else {
6983+
this._timeout = window.setTimeout(function(){this._checkTime(value);}.bind(this), 60000);
6984+
} else {
69866985
this._adjustDom(); // show the default
69876986
}
69886987
}

packages/uvalib-models/dist/uvalib-model-realtime-override.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6974,15 +6974,14 @@ class UvalibModelRealtimeOverride extends UvalibModelFBDB {
69746974
}
69756975

69766976
_checkTime(value) {
6977-
// see if we can parse the db value as a datetime
6978-
// var d = DateTime.fromISO(value);
6979-
var d = DateTime.fromSeconds(value);
6977+
// see if we can parse the db value as a datetime
6978+
var d = DateTime.fromMillis(value);
69806979

6981-
if (DateTime.local() < d) {
6980+
if (DateTime.local().toMillis() < d.toMillis()) {
69826981
// poll every few minutes to see if need to continue showing the override
69836982
this._adjustDom(this.defaultValue);
6984-
this._timeout = window.setTimeout(function(){this._checkTime(value);}.bind(this), 6000);
6985-
} else {
6983+
this._timeout = window.setTimeout(function(){this._checkTime(value);}.bind(this), 60000);
6984+
} else {
69866985
this._adjustDom(); // show the default
69876986
}
69886987
}

packages/uvalib-models/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@uvalib/uvalib-models",
33
"main": "uvalib-models.js",
4-
"version": "0.3.41",
4+
"version": "0.3.42",
55
"dependencies": {
66
"@uvalib/uvalib-account": "^0.1.19",
77
"luxon": "^1.25.0",

packages/uvalib-models/uvalib-model-realtime-override.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@ export default class UvalibModelRealtimeOverride extends UvalibModelFBDB {
4646
}
4747

4848
_checkTime(value) {
49-
// see if we can parse the db value as a datetime
50-
// var d = DateTime.fromISO(value);
51-
var d = DateTime.fromSeconds(value);
49+
// see if we can parse the db value as a datetime
50+
var d = DateTime.fromMillis(value);
5251

53-
if (DateTime.local() < d) {
52+
if (DateTime.local().toMillis() < d.toMillis()) {
5453
// poll every few minutes to see if need to continue showing the override
5554
this._adjustDom(this.defaultValue);
56-
this._timeout = window.setTimeout(function(){this._checkTime(value)}.bind(this), 6000);
57-
} else {
55+
this._timeout = window.setTimeout(function(){this._checkTime(value)}.bind(this), 60000);
56+
} else {
5857
this._adjustDom(); // show the default
5958
}
6059
}

0 commit comments

Comments
 (0)