Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bella-date

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bella-date

To manipulate date/time values

  • 1.1.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

bella-date

Simple util for datetime manipulation in your Node.js and browser apps.

NPM Build Status codecov Dependency Status NSP Status

Setup

  • Node.js

    npm install bella-date
    
  • CDN

  • Also supports ES6 Module, CommonJS, AMD and UMD style.

Usage

import {
  format,
  relativize,
  local,
  utc
} from 'bella-date';

let t = 1479374694886;

format(t, 'Y/m/d h:i:s'); //=> 2016/02/18 15:28:20
local(t); //=> Thu, 17 Nov 2016 16:24:54 GMT+0007
utc(t); //=> Thu, 17 Nov 2016 09:24:54 GMT
relativize(t); //=> 2 minutes ago

APIs

  • .format([Date | Timestamp] [, String pattern])
  • .relativize([Date | Timestamp])
  • .local([Date | Timestamp])
  • .utc([Date | Timestamp])

Default pattern for .format() method is 'D, M d, Y H:i:s A'.

Here are the available characters:

  • Y: full year, ex: 2050
  • y: short year, ex: 50
  • F: full month name, ex: August
  • M: short month name, ex: Aug
  • m: month index with zero, ex: 08 (in 08/24/2050)
  • n: short month name with no zero, ex: 8 (in 8/24/2050)
  • S: the ordering subfix for date, ext: 1st, 2nd, 3rd, 4th
  • j: day of the month, with no zero, ex: 3 (in 18/3/2050)
  • d: day of the month, with zero, ex: 03 (in 18/03/2050)
  • t: date in year
  • w: weekday in number
  • l: long name of weekday, ex: Sunday
  • D: short name of weekday, ex: Sun
  • G: hour, with no zero: 0 - 24
  • g: hour, with no zero: 0 - 12
  • h: hour, with zero: 00 - 24
  • i: minute: 00 - 59
  • s: second: 00 - 59
  • a: am, pm
  • A: AM, PM
  • O: timezone

Test

git clone https://github.com/ndaidong/bella-date.git
cd bella-date
npm install
npm test

License

The MIT License (MIT)

Keywords

FAQs

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

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