
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
count-to-day
Advanced tools
A simple javascript package that calculates countdown to a particular day of the week
It is a lightweight javascript package that calculates countdown to a particular day of the week.
npm install count-to-day --save
//or with yarn
yarn add count-to-day
Params | Type | Description |
---|---|---|
dayOfWeek | 'sunday' | 'monday' | 'tuesday' | 'wednesday' | 'thursday' | 'friday' | 'saturday' | the day of the week you want to count down to |
countDownCb | function | call back function whose params contains the countdown object: {days: number, hours: number, minutes: number, seconds: number } |
timeToCountTo | string | not mandatory. The time to count to, uses 24 hours clock time, e.g '12:00:00', '16:00:00', '1:00:00'. Defaults to '00:00:00' (12 midnight) |
isInfinite | boolean | A boolean flag that determines if the time should restart after the date to countdown to is reached. Defaults to false |
import { CountDownToDay } from "count-to-day";
CountDownToDay("wednesday", (count) => console.log("count=", count), "10:42:00");
//=> count = { days: number, hours: number, minutes: number, seconds: number }
//(logs an object like this that contains the countdown)
Or use in a custom hook
import { useEffect, useState } from "react";
import { CountDownToDay, StopCountdown } from "count-to-day";
const useCountdown = (dayOfWeek = "friday", timeToCountTo = "00:00:00") => {
const [count, setCount] = useState({
days: "",
hours: "",
minutes: "",
seconds: ""
});
useEffect(() => {
CountDownToDay(dayOfWeek, setCount, timeToCountTo);
return () => {
StopCountdown();
};
}, [dayOfWeek, timeToCountTo]);
return { count };
};
export default useCountdown;
FAQs
A simple javascript package that calculates countdown to a particular day of the week
The npm package count-to-day receives a total of 11 weekly downloads. As such, count-to-day popularity was classified as not popular.
We found that count-to-day demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.