New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fdate

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fdate

Light-weight, faster datetime formatter for modern browsers

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by200%
Maintainers
1
Weekly downloads
 
Created
Source

⏰ fdate

NPM

Light-weight, faster datetime formatter for modern browsers.

fdate is ...

  • formatter of Date
  • 👼 light-weight as a feather (~1kB gzipped!)
  • 🦄 ~x1.5 faster than moment
  • 🆕 powered by Proxy and Template literals

Table of Contents

Install

npm i --save fdate
# -- OR --
yarn add fdate

-- OR --

<script src="https://unpkg.com/fdate"></script>

Usage

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.

Benchmark

See benchmarks for more details.

Speed

  • Machine: Windows 10 Education x64, Core i7-6700HQ, Memory 16GB
  • Node: v9.11.1
Basic

new Date() -> 2000/01/06

dateformat x 123,624 ops/sec ±0.73% (91 runs sampled)
luxon      x 202,952 ops/sec ±0.90% (92 runs sampled)
fecha      x 221,008 ops/sec ±0.72% (91 runs sampled)
dayjs      x 317,960 ops/sec ±0.93% (82 runs sampled)
moment     x 407,424 ops/sec ±0.89% (85 runs sampled)
time-stamp x 430,194 ops/sec ±0.80% (89 runs sampled)
date-fns   x 430,681 ops/sec ±0.85% (87 runs sampled)
fdate      x 614,498 ops/sec ±0.77% (89 runs sampled)

Fastest is fdate
Advanced

new Date() -> 1月6日(木) (written in Japanese)

luxon      x     566 ops/sec ±0.72% (87 runs sampled)
dateformat x 119,879 ops/sec ±0.61% (93 runs sampled)
date-fns   x 121,835 ops/sec ±2.75% (86 runs sampled)
fecha      x 222,093 ops/sec ±0.68% (92 runs sampled)
moment     x 468,912 ops/sec ±1.31% (89 runs sampled)
fdate      x 540,576 ops/sec ±1.35% (90 runs sampled)

Fastest is fdate

Bundle size

See benchmarks/scripts.

moment     | 52,945 bytes (gzip: 17,302 bytes)
luxon      | 52,645 bytes (gzip: 15,384 bytes)
date-fns   |  9,215 bytes (gzip:  3,289 bytes)
dayjs      |  6,152 bytes (gzip:  2,203 bytes)
fecha      |  4,913 bytes (gzip:  1,963 bytes)
dateformat |  3,096 bytes (gzip:  1,550 bytes)
fdate      |  1,462 bytes (gzip:    680 bytes)
time-stamp |    516 bytes (gzip:    347 bytes)

Contribute

PRs accepted.

License

MIT (c) 3846masa

Keywords

FAQs

Package last updated on 28 Apr 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc