Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Light-weight, faster datetime formatter for modern browsers.
fdate
is ...
moment
)Template literals
npm i --save fdate
# -- OR --
yarn add fdate
-- OR --
<script src="https://unpkg.com/fdate"></script>
import fdate from 'fdate';
const render = fdate`${'YYYY'}/${'MM'}/${'DD'}`;
console.log(render(new Date()));
// i18n
const dayOfWeekName = ({ d }) => [...'日月火水木金土'][d];
const render = fdate`${'M'}月${'D'}日${dayOfWeekName}曜日`;
console.log(render(new Date()));
See examples.
If you use fdate via webpack, please set alias.
{
resolve: {
alias: {
fdate: require.resolve('fdate'),
},
},
}
When using at legacy browser (e.g. IE), please setup loader for transpiling.
(However, fdate will be slow at legacy browser. Please consider using other libraries (e.g. fecha, dayjs).
{
loader: [
{
test: /\.js$/,
exclude: {
// Pass fdate to babel-loader when building for legacy browser
include: /(node_modules|bower_components)/,
exclude: [/node_modules[\//]fdate/],
},
use: ['babel-loader'],
},
],
}
See benchmarks for more details.
new Date()
-> 2000/01/06
ops/sec | |||
---|---|---|---|
fdate | 279,762 ops/sec | ±1.11% | (88 runs sampled) |
time-stamp | 247,083 ops/sec | ±1.11% | (90 runs sampled) |
date-fns | 244,455 ops/sec | ±1.05% | (89 runs sampled) |
moment | 241,140 ops/sec | ±1.33% | (91 runs sampled) |
fecha | 232,466 ops/sec | ±1.08% | (91 runs sampled) |
dayjs | 210,611 ops/sec | ±0.97% | (91 runs sampled) |
luxon | 167,198 ops/sec | ±1.13% | (89 runs sampled) |
dateformat | 96,692 ops/sec | ±1.05% | (86 runs sampled) |
ops/sec | |||
---|---|---|---|
fdate | 573,465 ops/sec | ±1.42% | (60 runs sampled) |
time-stamp | 387,719 ops/sec | ±2.25% | (59 runs sampled) |
fecha | 375,460 ops/sec | ±0.72% | (61 runs sampled) |
date-fns | 342,209 ops/sec | ±1.25% | (61 runs sampled) |
moment | 325,720 ops/sec | ±1.08% | (62 runs sampled) |
dayjs | 244,039 ops/sec | ±4.33% | (59 runs sampled) |
luxon | 167,208 ops/sec | ±1.36% | (60 runs sampled) |
dateformat | 97,894 ops/sec | ±1.90% | (60 runs sampled) |
ops/sec | |||
---|---|---|---|
fdate | 1,135,997 ops/sec | ±2.55% | (59 runs sampled) |
fecha | 823,049 ops/sec | ±3.11% | (57 runs sampled) |
time-stamp | 531,863 ops/sec | ±4.40% | (58 runs sampled) |
date-fns | 435,223 ops/sec | ±3.51% | (59 runs sampled) |
moment | 410,513 ops/sec | ±3.49% | (61 runs sampled) |
dayjs | 369,565 ops/sec | ±2.85% | (59 runs sampled) |
luxon | 170,537 ops/sec | ±2.88% | (61 runs sampled) |
dateformat | 63,390 ops/sec | ±2.26% | (63 runs sampled) |
new Date()
-> 1月6日(木)
(written in Japanese)ops/sec | |||
---|---|---|---|
fdate | 291,909 ops/sec | ±1.26% | (88 runs sampled) |
moment | 258,888 ops/sec | ±1.62% | (89 runs sampled) |
fecha | 245,678 ops/sec | ±0.99% | (93 runs sampled) |
date-fns | 189,735 ops/sec | ±0.89% | (90 runs sampled) |
dateformat | 96,810 ops/sec | ±0.95% | (92 runs sampled) |
luxon | 688 ops/sec | ±1.18% | (85 runs sampled) |
ops/sec | |||
---|---|---|---|
fdate | 536,842 ops/sec | ±0.82% | (65 runs sampled) |
fecha | 394,640 ops/sec | ±1.58% | (62 runs sampled) |
moment | 322,982 ops/sec | ±1.25% | (61 runs sampled) |
date-fns | 254,257 ops/sec | ±1.00% | (63 runs sampled) |
dateformat | 96,633 ops/sec | ±0.77% | (62 runs sampled) |
luxon | 624 ops/sec | ±1.42% | (44 runs sampled) |
ops/sec | |||
---|---|---|---|
fdate | 1,208,619 ops/sec | ±2.43% | (63 runs sampled) |
fecha | 827,057 ops/sec | ±4.89% | (57 runs sampled) |
moment | 380,293 ops/sec | ±3.39% | (56 runs sampled) |
date-fns | 317,868 ops/sec | ±2.57% | (61 runs sampled) |
dateformat | 62,233 ops/sec | ±2.06% | (63 runs sampled) |
luxon | 864 ops/sec | ±2.93% | (54 runs sampled) |
size | gzipped | |
---|---|---|
time-stamp | 1.74 KB | 861 bytes |
fdate | 2.29 KB | 943 bytes |
dateformat | 3.80 KB | 1.81 KB |
fecha | 5.50 KB | 2.18 KB |
dayjs | 7.21 KB | 2.76 KB |
date-fns | 9.34 KB | 3.13 KB |
moment | 51.85 KB | 16.77 KB |
luxon | 60.37 KB | 18.45 KB |
PRs accepted.
FAQs
Light-weight, faster datetime formatter for modern browsers
The npm package fdate receives a total of 5 weekly downloads. As such, fdate popularity was classified as not popular.
We found that fdate 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.