Skip to content

Commit

Permalink
Merge pull request #410 from SU-SWS/release/v4.1.6
Browse files Browse the repository at this point in the history
Release/v4.1.6
  • Loading branch information
yvonnetangsu authored Apr 2, 2024
2 parents 62ea3ec + f81b96e commit 872f662
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/components/giving-tuesday/Countdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const getDescriptorString = (descriptor, time) => {
const convertDaysToHours = (days) => (days ? days * 24 : 0);

const Countdown = ({ blok }) => {
const { date, hasDays, hourPieRange } = blok;
const { date, hasDays, hourPieRange, useNew } = blok;
const [countdownDate, setCountdownDate] = useState(null);
const [days, hours, minutes, seconds] = UseCountdown(countdownDate) || [];
const displayHours = hasDays ? hours : convertDaysToHours(days) + hours;
Expand All @@ -21,12 +21,21 @@ const Countdown = ({ blok }) => {
useEffect(() => {
if (!countdownDate) {
if (!date) {
/**
* manually set date to 04/04/2024 7AM w/ a UTC offset (no daylight savings)
* this should only stay for the current campaign, can remove this and make
* component purely storyblok configurable after campaign
*/
setCountdownDate(new Date(Date.UTC(2024, 3, 4, 14, 0, 0)));
if (useNew) {
/**
* manually set date to 04/05/2024 7PM w/ a UTC offset (no daylight savings)
* this should only stay for the current campaign, can remove this and make
* component purely storyblok configurable after campaign
*/
setCountdownDate(new Date(Date.UTC(2024, 3, 6, 2, 0, 0)));
} else {
/**
* manually set date to 04/04/2024 7AM w/ a UTC offset (no daylight savings)
* this should only stay for the current campaign, can remove this and make
* component purely storyblok configurable after campaign
*/
setCountdownDate(new Date(Date.UTC(2024, 3, 4, 14, 0, 0)));
}
} else {
/**
* the date prop returns in the following format: "2023-11-21 23:56"
Expand Down

0 comments on commit 872f662

Please sign in to comment.