Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

moment-timezone-jp

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

moment-timezone-jp

軽量に(=browser等にやさしく、無駄なものを省いて)momentのデフォルトタイムゾーンをJSTにする

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

moment-timezone-jp

momentjsで日本のtimezoneをデフォルトにできます。

環境を選ばず利用できます。 主にbrowserでの用途(bundleしたりとか)に便利。

ちなみにソースは4行。 カスタマイズしたければソースをマネしたほうが早いですね。

momentの代わりに使うといいです。

どのぐらい軽量になったのか

browserifyしたファイルを比べてみました。

before 312941 byte # 全timezoneの設定がある場合
after  133262 byte # Japanの設定だけの場合

175kbほど削減できました。 timezoneの全設定JSONファイルがそれぐらい大きいのです。

当然、そのファイルを読んでtimezoneを解釈する時間もなくなりますので、 ユーザーに優しいといえます。

機能は日本で使う限り、当然ながら、元のmoment-timezoneと全く同等です。

インストール

npm install moment-timezone-jp

使い方

var moment = require('moment-timezone-jp');
moment();  // momentjsと同じインターフェイス

Keywords

moment

FAQs

Package last updated on 10 Nov 2017

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