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.4
  • 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!)
  • 🦄 very faster than other datetime libraries (e.g. moment)
  • 🆕 powered by 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.

Basic usage

  • new Date() -> 2000/01/06
Node.js v9.11.1
ops/sec
fdate993,227 ops/sec±0.97%(87 runs sampled)
time-stamp409,736 ops/sec±2.20%(88 runs sampled)
date-fns400,837 ops/sec±1.21%(88 runs sampled)
moment391,224 ops/sec±1.61%(87 runs sampled)
dayjs266,590 ops/sec±1.84%(83 runs sampled)
fecha193,034 ops/sec±2.46%(81 runs sampled)
dateformat114,571 ops/sec±1.58%(86 runs sampled)
luxon2,506 ops/sec±1.91%(82 runs sampled)
Chrome 66.0.3359
ops/sec
fdate948,727 ops/sec±1.21%(65 runs sampled)
time-stamp683,091 ops/sec±1.04%(65 runs sampled)
fecha548,628 ops/sec±0.90%(64 runs sampled)
moment505,969 ops/sec±1.13%(64 runs sampled)
date-fns488,131 ops/sec±0.97%(63 runs sampled)
dayjs307,569 ops/sec±0.59%(63 runs sampled)
dateformat133,583 ops/sec±0.92%(63 runs sampled)
luxon2,808 ops/sec±3.24%(19 runs sampled)
Firefox 59.0.0
ops/sec
fdate1,373,935 ops/sec±2.58%(48 runs sampled)
fecha988,180 ops/sec±2.68%(47 runs sampled)
time-stamp601,037 ops/sec±2.84%(45 runs sampled)
moment479,960 ops/sec±2.57%(47 runs sampled)
date-fns478,713 ops/sec±3.20%(47 runs sampled)
dayjs269,816 ops/sec±3.10%(47 runs sampled)
dateformat62,120 ops/sec±2.12%(50 runs sampled)
luxon2,945 ops/sec±2.72%(20 runs sampled)

Advanced usage

  • new Date() -> 1月6日(木) (written in Japanese)
Node.js v9.11.1
ops/sec
fdate842,085 ops/sec±1.83%(83 runs sampled)
moment479,692 ops/sec±7.26%(87 runs sampled)
fecha204,389 ops/sec±2.47%(84 runs sampled)
date-fns129,711 ops/sec±1.67%(86 runs sampled)
dateformat111,659 ops/sec±1.92%(82 runs sampled)
luxon549 ops/sec±1.23%(87 runs sampled)
Chrome 66.0.3359
ops/sec
fdate1,159,099 ops/sec±0.73%(65 runs sampled)
moment619,972 ops/sec±0.74%(62 runs sampled)
fecha573,963 ops/sec±1.10%(62 runs sampled)
date-fns368,440 ops/sec±0.55%(64 runs sampled)
dateformat142,079 ops/sec±0.49%(64 runs sampled)
luxon562 ops/sec±1.11%(60 runs sampled)
Firefox 59.0.0
ops/sec
fdate1,358,185 ops/sec±2.62%(47 runs sampled)
fecha965,889 ops/sec±3.61%(46 runs sampled)
date-fns342,457 ops/sec±2.67%(48 runs sampled)
moment449,780 ops/sec±2.26%(48 runs sampled)
dateformat60,055 ops/sec±1.60%(49 runs sampled)
luxon554 ops/sec±2.17%(45 runs sampled)

Bundle size (Webpack)

sizegzipped
time-stamp1.12 KB658 bytes
fdate2.14 KB915 bytes
dateformat3.36 KB1.66 KB
fecha5.13 KB2.06 KB
dayjs6.30 KB2.26 KB
date-fns8.93 KB3.02 KB
luxon50.86 KB15.16 KB
moment51.29 KB16.63 KB

Contribute

PRs accepted.

License

MIT (c) 3846masa

Keywords

FAQs

Package last updated on 30 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