
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
simple-ts-date-picker
Advanced tools
Super simple but extensible datepicker
To get a simple idea about the default behavior check the demo: https://codesandbox.io/s/8nk47k5z29
This repo is split up in a few different sections, first the components section: https://github.com/DJWassink/SimpleDatePicker/tree/master/src/components
Here are some stateless components which are each responsible for rendering a part of the datepicker,
All of these components can be imported/overwritten to fit your needs. The most user friendly component is the statefull component called SimpleDatePicker which uses all these components to render a datepicker as can be seen here: https://codesandbox.io/s/8nk47k5z29 this component has the following props:
interface SimpleDatePickerProps {
i18n?: I18n;
value: Date;
weekStart?: number;
onChange: (value: Date) => void;
renderHeader?: (i18n: I18n, screen: Date, onScreenChange: (screen: Date) => void) => JSX.Element;
renderAbbreviations?: (i18n: I18n, weekStart: number) => JSX.Element;
renderDay?: (
day: Date,
value: Date,
screen: Date,
cursor: Date,
onClick: () => void,
onMouseMove: () => void
) => JSX.Element;
}
As you can see the only required props are the value
and onChange
properties. The other props are used to customize the default behavior of the datepicker. The renderXXX props are used to be able to overwrite an existing part of the datepicker, an good example can be seen here: https://codesandbox.io/s/621v1nw0l3
The utils file contains a few utility functions which are used by the different components, the most noteworthy functions are the following:
generateMatrix = (date: Date, weekStart: number): Date[][]
which generates a 7 (width) by 6 (height) matrix containing all the dates for a month, the date params indicates the month adn the weekStart is an number which indicates on which day a week starts (for example 1 means monday).isInMatrix = (matrix: Date[][], date: Date): boolean
simply check if the given day exists in the given matrix.getFirstDayOfMonth = (date: Date): Date
return a date which has the day set to the first day of the month given by the date paramter.getFirstDayOfWeek = (date: Date, weekStart: number): Date
returns the first day of a week, usefull in combination with getFirstDayOfMonth
, if you first do the firstDayOfMonth and then this function you get the most to left date in the datepicker.Of course there are a few more interesting functions, just see the code which do what and which are usefull.
It is possible to add your own translations, default we use the english translations which you can find in https://github.com/DJWassink/SimpleTsDatePicker/blob/master/src/i18n.ts, if you want your own translations simply copy the I18n
const from that file and translate it. Then pass it as the i18n parameter to the datepicker component.
FAQs
An simple best extensible typescript react datepicker
We found that simple-ts-date-picker 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.