Show exact time of discovery
This commit is contained in:
parent
fd2ee88e5d
commit
69f67d427e
@ -28,7 +28,10 @@ function humaniseDate(unixTime) {
|
|||||||
return (new Date(unixTime * 1000)).toLocaleDateString("en-GB", {
|
return (new Date(unixTime * 1000)).toLocaleDateString("en-GB", {
|
||||||
day: "2-digit",
|
day: "2-digit",
|
||||||
month: "2-digit",
|
month: "2-digit",
|
||||||
year: "numeric"
|
year: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
second: "2-digit"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +40,7 @@ function humaniseDate(unixTime) {
|
|||||||
function myFetch(url, options) {
|
function myFetch(url, options) {
|
||||||
if (options == null) options = {}
|
if (options == null) options = {}
|
||||||
if (options.credentials == null) options.credentials = 'same-origin'
|
if (options.credentials == null) options.credentials = 'same-origin'
|
||||||
return fetch(url, options).then(function(response) {
|
return fetch(url, options).then(function (response) {
|
||||||
if (response.status >= 200 && response.status < 300) {
|
if (response.status >= 200 && response.status < 300) {
|
||||||
return Promise.resolve(response)
|
return Promise.resolve(response)
|
||||||
} else {
|
} else {
|
||||||
@ -60,26 +63,25 @@ Date.prototype.getWeek = function (dowOffset) {
|
|||||||
/* getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
|
/* getWeek() was developed by Nick Baicoianu at MeanFreePath: http://www.meanfreepath.com */
|
||||||
|
|
||||||
dowOffset = 1;
|
dowOffset = 1;
|
||||||
let newYear = new Date(this.getFullYear(),0,1);
|
let newYear = new Date(this.getFullYear(), 0, 1);
|
||||||
let day = newYear.getDay() - dowOffset; //the day of week the year begins on
|
let day = newYear.getDay() - dowOffset; //the day of week the year begins on
|
||||||
day = (day >= 0 ? day : day + 7);
|
day = (day >= 0 ? day : day + 7);
|
||||||
let daynum = Math.floor((this.getTime() - newYear.getTime() -
|
let daynum = Math.floor((this.getTime() - newYear.getTime() -
|
||||||
(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000) + 1;
|
(this.getTimezoneOffset() - newYear.getTimezoneOffset()) * 60000) / 86400000) + 1;
|
||||||
let weeknum;
|
let weeknum;
|
||||||
// if the year starts before the middle of a week
|
// if the year starts before the middle of a week
|
||||||
if(day < 4) {
|
if (day < 4) {
|
||||||
weeknum = Math.floor((daynum+day-1)/7) + 1;
|
weeknum = Math.floor((daynum + day - 1) / 7) + 1;
|
||||||
if(weeknum > 52) {
|
if (weeknum > 52) {
|
||||||
nYear = new Date(this.getFullYear() + 1,0,1);
|
var nYear = new Date(this.getFullYear() + 1, 0, 1);
|
||||||
nday = nYear.getDay() - dowOffset;
|
var nday = nYear.getDay() - dowOffset;
|
||||||
nday = nday >= 0 ? nday : nday + 7;
|
nday = nday >= 0 ? nday : nday + 7;
|
||||||
/*if the next year starts before the middle of
|
/*if the next year starts before the middle of
|
||||||
the week, it is week #1 of that year*/
|
the week, it is week #1 of that year*/
|
||||||
weeknum = nday < 4 ? 1 : 53;
|
weeknum = nday < 4 ? 1 : 53;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
weeknum = Math.floor((daynum + day - 1) / 7);
|
||||||
weeknum = Math.floor((daynum+day-1)/7);
|
|
||||||
}
|
}
|
||||||
return weeknum;
|
return weeknum;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user