Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
native-datepicker
Advanced tools
Styleable datepicker utilizing the native
<input type="date">
Features:
Supported:
Not supported (datepicker is hidden):
const NativeDatepicker = require('native-datepicker');
const picker = new NativeDatepicker({
onChange: (newValue) => {
console.log(newValue);
},
});
someElement.appendChild(picker.element);
See API.
const NativeDatepicker = require('native-datepicker/src/react');
const SomeComponent = () => {
const [date, setDate] = useState('2020-11-01');
return (
<NativeDatepicker value={date} onChange={(newValue) => setDate(newValue)} />
);
};
See React API.
class NativeDatepicker
constructor(options)
options
is an object with the following properties:
options.onChange
type: function
default: (value) => {}
Callback function which is called when the user selects a new date.
Receives the new value as string (e.g. "2020-11-01"
or "2020-11-01 13:15:00"
; just the date-portion of the original value is replaced).
options.existingElement
type: DOMElement
default: null
If set, existing element will be used instead of creating a new span
element.
options.win
type: Window
default: window
For the rare use case (e.g. using inside a child iframe) when setting window
is necessary.
setValue(dateString)
Set the value of the datepicker.
dateString
should be a string containing a date in YYYY-MM-DD
format. For example, all of these are valid:
"2020-11-01"
"2020-11-01 13:15:00"
"2020-11-01T13:15:00"
Upon changes, NativeDatepicker will replace the date-portion of the string and return the result.
element
Contains a reference to the datepicker element.
NativeDatepicker
componentProps:
<NativeDatepicker
value={date}
onChange={(newValue) => {}}
className="customClassName"
>
{optionalChildren}
</NativeDatepicker>
props.value
type: string
default: ""
Initial value. Examples:
value="2020-11-01"
value="2020-11-01 13:15:00"
value="2020-11-01T13:15:00"
props.onChange
type: function
default: (value) => {}
Callback function which is called when the user selects a new date.
Receives the new value as string (e.g. "2020-11-01"
or "2020-11-01 13:15:00"
; just the date-portion of the original value is replaced).
props.className
type: string
default: ""
Custom className for the created element.
Example with className="CustomClass"
:
<span class="NativeDatepicker CustomClass">
<input class="NativeDatepicker__input" type="date" />
</span>
optionalChildren
If children
are given, they are inserted into the resulting DOM. This can be used for any styling needs.
Example:
<span class="NativeDatepicker">
<!-- Children will be inserted here -->
<input class="NativeDatepicker__input" type="date" />
</span>
The following DOM is created for each datepicker:
<span class="NativeDatepicker">
<input class="NativeDatepicker__input" type="date" />
</span>
The recommended way to style the datepicker is to apply styles (e.g. width/height and a background-image) to the topmost element. Example:
.NativeDatepicker {
width: 16px;
height: 16px;
background: transparent url(...) no-repeat center center;
}
Note: under normal circumstances you should not add any styles to .NativeDatepicker__input
!
Source files reside in src/
. They should be remain valid ES5 code (they are not precompiled in any way).
1.0.2
This is the first public release of NativeDatepicker.
FAQs
> Styleable datepicker utilizing the native ``
The npm package native-datepicker receives a total of 5,613 weekly downloads. As such, native-datepicker popularity was classified as popular.
We found that native-datepicker 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
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.