Use native date constructor to calculate timeout until midnight
This commit is contained in:
parent
5ba0e33fb9
commit
def494533b
@ -92,8 +92,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const moment = require("moment");
|
|
||||||
|
|
||||||
import {throttle} from "lodash";
|
import {throttle} from "lodash";
|
||||||
|
|
||||||
import NetworkList from "./NetworkList.vue";
|
import NetworkList from "./NetworkList.vue";
|
||||||
@ -134,7 +132,10 @@ export default {
|
|||||||
isPublic: () => document.body.classList.contains("public"),
|
isPublic: () => document.body.classList.contains("public"),
|
||||||
msUntilNextDay() {
|
msUntilNextDay() {
|
||||||
// Compute how many milliseconds are remaining until the next day starts
|
// Compute how many milliseconds are remaining until the next day starts
|
||||||
return moment().add(1, "day").startOf("day") - moment();
|
const today = new Date();
|
||||||
|
const tommorow = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
|
||||||
|
|
||||||
|
return tommorow - today;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hoursPassed() {
|
hoursPassed() {
|
||||||
return moment.duration(moment().diff(moment(this.message.time))).asHours();
|
return (Date.now() - Date.parse(this.message.time)) / 3600000;
|
||||||
},
|
},
|
||||||
dayChange() {
|
dayChange() {
|
||||||
this.$forceUpdate();
|
this.$forceUpdate();
|
||||||
|
Loading…
Reference in New Issue
Block a user