mirror of
https://github.com/daledavies/jump.git
synced 2025-11-17 02:10:42 +01:00
Implement front end location/time/weather etc
This commit is contained in:
18
jumpapp/assets/js/src/classes/Clock.js
Normal file
18
jumpapp/assets/js/src/classes/Clock.js
Normal file
@@ -0,0 +1,18 @@
|
||||
export default class Clock {
|
||||
constructor(utcshift = 0) {
|
||||
this.utcshift = utcshift*1000;
|
||||
this.shiftedtimestamp = new Date().getTime()+this.utcshift;
|
||||
this.shifteddate = new Date(this.shiftedtimestamp);
|
||||
}
|
||||
|
||||
get_formatted_time() {
|
||||
const hour = String(this.shifteddate.getHours()).padStart(2, "0");
|
||||
const minutes = String(this.shifteddate.getMinutes()).padStart(2, "0");
|
||||
return hour + ":" + minutes;
|
||||
}
|
||||
|
||||
get_hour() {
|
||||
return this.shifteddate.getHours();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user