diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..88dfbde --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "atlascode.bitbucket.enabled": true +} \ No newline at end of file diff --git a/pages/api/days/[days].js b/pages/api/days/[days].js index c3b8319..4b24b31 100644 --- a/pages/api/days/[days].js +++ b/pages/api/days/[days].js @@ -70,7 +70,20 @@ const ApiResponse = async (req, res) => { ctx.textAlign = "left"; ctx.font = "50px AmaticSC"; //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); - ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); + var copyrightSymbol = 169; // 0xA9 + var $now = new Date(); + var $yearCount = $now.getFullYear(); + ctx.fillText( + String.fromCharCode(copyrightSymbol) + + " " + + "WWW.GETAHEADCHRISTMAS.CO.UK " + + " " + + $yearCount, + 40, + 740 + ); + + $yearCount; console.log(ctx); diff --git a/pages/api/sleeps/[sleeps].js b/pages/api/sleeps/[sleeps].js index fba5d9e..126a8e3 100644 --- a/pages/api/sleeps/[sleeps].js +++ b/pages/api/sleeps/[sleeps].js @@ -70,8 +70,18 @@ const ApiResponse = async (req, res) => { ctx.textAlign = "left"; ctx.font = "50px AmaticSC"; //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); - ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); - + var copyrightSymbol = 169; // 0xA9 + var $now = new Date(); + var $yearCount = $now.getFullYear(); + ctx.fillText( + String.fromCharCode(copyrightSymbol) + + " " + + "WWW.GETAHEADCHRISTMAS.CO.UK " + + " " + + $yearCount, + 40, + 740 + ); console.log(ctx); const png = canvas.toBuffer("image/png"); diff --git a/pages/api/weeks/[weeks].js b/pages/api/weeks/[weeks].js index 2188708..cdcff6c 100644 --- a/pages/api/weeks/[weeks].js +++ b/pages/api/weeks/[weeks].js @@ -62,8 +62,18 @@ const ApiResponse = async (req, res) => { ctx.textAlign = "left"; ctx.font = "50px AmaticSC"; //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); - ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); - + var copyrightSymbol = 169; // 0xA9 + var $now = new Date(); + var $yearCount = $now.getFullYear(); + ctx.fillText( + String.fromCharCode(copyrightSymbol) + + " " + + "WWW.GETAHEADCHRISTMAS.CO.UK " + + " " + + $yearCount, + 40, + 740 + ); console.log(ctx); const png = canvas.toBuffer("image/png"); diff --git a/pages/api/weekstoday/[weekstoday].js b/pages/api/weekstoday/[weekstoday].js index 4118237..4c3e847 100644 --- a/pages/api/weekstoday/[weekstoday].js +++ b/pages/api/weekstoday/[weekstoday].js @@ -62,7 +62,18 @@ const ApiResponse = async (req, res) => { ctx.textAlign = "left"; ctx.font = "50px AmaticSC"; //ctx.strokeText("WWW.GETAHEADCHRISTMAS.CO.UK", x, y); - ctx.fillText("WWW.GETAHEADCHRISTMAS.CO.UK", 40, 740); + var copyrightSymbol = 169; // 0xA9 + var $now = new Date(); + var $yearCount = $now.getFullYear(); + ctx.fillText( + String.fromCharCode(copyrightSymbol) + + " " + + "WWW.GETAHEADCHRISTMAS.CO.UK " + + " " + + $yearCount, + 40, + 740 + ); console.log(ctx); diff --git a/pages/days.js b/pages/days/[days].js similarity index 92% rename from pages/days.js rename to pages/days/[days].js index 94f1696..f507b59 100644 --- a/pages/days.js +++ b/pages/days/[days].js @@ -8,7 +8,7 @@ import axios from "axios"; const FourOhFour = (props) => { const router = useRouter(); - let numbDays = router.query.n; + let numbDays = router.query.days; return (
{ + const router = useRouter(); + + let numbWeeks = router.query.weekstoday; + + function addThousandsSeparator(e) { + return e.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"); + } + + function countDownToChristmas() { + var $now = new Date(); + var $yearCount = $now.getFullYear(); + + if ($now.getMonth() + 1 == 12 && $now.getDate() >= 25) { + $yearCount = $yearCount + 1; + } + + var $xmas = new Date($yearCount, 11, 25); + var $now_seconds = Math.round($now.getTime() / 1e3); + var $xmas_seconds = Math.round($xmas.getTime() / 1e3); + var $seconds_to_go = $xmas_seconds - $now_seconds; + var $minutes_to_go = Math.round($seconds_to_go / 60); + var $hours_to_go = ($minutes_to_go / 60).toFixed(1); + var $days_to_go = ($hours_to_go / 24 - 1).toFixed(); + var $sleeps_to_go = parseInt($days_to_go) + 1; + var $weeks_to_go = ($minutes_to_go / 60 / 24 / 7).toFixed(2); + var $fortnights_to_go = ($minutes_to_go / 60 / 24 / 7 / 2).toFixed(2); + var $months_to_go = ($weeks_to_go / (52 / 12)).toFixed(2); + var $years_to_go = ($weeks_to_go / 52).toFixed(2); + + return $days_to_go; + } + + return ( +
+ weeks +
+ ); +}; + +export default FourOhFour; diff --git a/pages/sleeps.js b/pages/sleeps/[sleeps].js similarity index 89% rename from pages/sleeps.js rename to pages/sleeps/[sleeps].js index 5b4ecc0..7950ad9 100644 --- a/pages/sleeps.js +++ b/pages/sleeps/[sleeps].js @@ -6,7 +6,7 @@ import { useRouter } from "next/router"; const FourOhFour = (props) => { const router = useRouter(); - let numbSleeps = router.query.n; + let numbSleeps = router.query.sleeps; return (
{ const router = useRouter(); - let numbWeeks = router.query.n; + let numbWeeks = router.query.weeks; return (
{ const router = useRouter(); - let numbWeeks = router.query.n; + let numbWeeks = router.query.weekstoday; return (