Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
saaqi committed May 1, 2024
1 parent da81cb1 commit bf7d3b9
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 40 deletions.
Binary file added bun.lockb
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
1 change: 0 additions & 1 deletion docs/assets/index-1s_N2LIW.js

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/assets/index-B4y8b4fw.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html

Large diffs are not rendered by default.

116 changes: 79 additions & 37 deletions src/js/contact.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,101 @@
// Store status
function checkStoreStatus() {
// Set the timezone to Orange City, Florida, USA
// // Store status
function storeStatus() {
const timeZone = "America/New_York";
const now = new Date();
const orangeCityTime = new Date(
now.toLocaleString("en-US", { timeZone: timeZone })
const localTime = new Date(
now.toLocaleString("en-US", {
timeZone: timeZone
})
);
// Days ---------------------------
const options = { weekday: "long" };
const formattedTime = now.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
timeZone: timeZone,
});
const orangeCityDayToday = new Intl.DateTimeFormat("en-US", options).format(localTime);
const outputDay = `${orangeCityDayToday} ${formattedTime}`;

const dayOfWeek = orangeCityTime.toLocaleString("en-US", {
// Time --------------------------
const hours = localTime.getHours();
const dayOfWeek = localTime.toLocaleString("en-US", {
timeZone,
weekday: "long",
});
const hours = orangeCityTime.getHours();

const isOpeningHours =
(dayOfWeek === "Sunday" && hours >= 9 && hours < 17) ||
(dayOfWeek !== "Sunday" && hours >= 8 && hours < 19);

return isOpeningHours
const outputTime = isOpeningHours
? '<span class="open text-success fw-bold">Open</span> come on down'
: '<span class="closed text-danger fw-bold">Closed</span> see you in the morning';
}
function detectDayToday() {
const currentDate = new Date();
const options = { weekday: "long" };
const dayToday = new Intl.DateTimeFormat("en-US", options).format(
currentDate
);
: '<span class="closed text-danger fw-bold">Closed</span> see you tomorrow. 🙂';

const orangeCityTimeZone = "America/New_York"; // Time zone identifier for Orange City, Florida
const formattedTime = currentDate.toLocaleTimeString("en-US", {
hour: "numeric",
minute: "2-digit",
hour12: true,
timeZone: orangeCityTimeZone,
});

const orangeCityDate = new Date(
currentDate.toLocaleString("en-US", { timeZone: orangeCityTimeZone })
);
const orangeCityDayToday = new Intl.DateTimeFormat("en-US", options).format(
orangeCityDate
);

return `${orangeCityDayToday} ${formattedTime}`;
return `${outputDay}, We are ${outputTime}`;
}

function updateStatusRealtime() {
document.getElementById(
"storestatus"
).innerHTML = `${detectDayToday()}, We Are ${checkStoreStatus()}`;
document.getElementById("storestatus").innerHTML =
`${storeStatus()}`;
}

updateStatusRealtime();
setInterval(updateStatusRealtime, 15000);
// function checkStoreStatus() {
// // Set the timezone to Orange City, Florida, USA
// const timeZone = "America/New_York";
// const now = new Date();
// const orangeCityTime = new Date(
// now.toLocaleString("en-US", { timeZone: timeZone })
// );

// const dayOfWeek = orangeCityTime.toLocaleString("en-US", {
// timeZone,
// weekday: "long",
// });
// const hours = orangeCityTime.getHours();

// const isOpeningHours =
// (dayOfWeek === "Sunday" && hours >= 9 && hours < 17) ||
// (dayOfWeek !== "Sunday" && hours >= 8 && hours < 19);

// return isOpeningHours
// ? '<span class="open text-success fw-bold">Open</span> come on down'
// : '<span class="closed text-danger fw-bold">Closed</span> see you in the morning';
// }
// function detectDayToday() {
// const currentDate = new Date();
// const options = { weekday: "long" };
// const dayToday = new Intl.DateTimeFormat("en-US", options).format(
// currentDate
// );

// const orangeCityTimeZone = "America/New_York"; // Time zone identifier for Orange City, Florida
// const formattedTime = currentDate.toLocaleTimeString("en-US", {
// hour: "numeric",
// minute: "2-digit",
// hour12: true,
// timeZone: orangeCityTimeZone,
// });

// const orangeCityDate = new Date(
// currentDate.toLocaleString("en-US", { timeZone: orangeCityTimeZone })
// );
// const orangeCityDayToday = new Intl.DateTimeFormat("en-US", options).format(
// orangeCityDate
// );

// return `${orangeCityDayToday} ${formattedTime}`;
// }

// function updateStatusRealtime() {
// document.getElementById(
// "storestatus"
// ).innerHTML = `${detectDayToday()}, We Are ${checkStoreStatus()}`;
// }

// updateStatusRealtime();
// setInterval(updateStatusRealtime, 15000);



Expand Down

0 comments on commit bf7d3b9

Please sign in to comment.