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

@datatypes/moment

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@datatypes/moment

ISO 8601 based time and date module

  • 0.3.0
  • Source
  • npm
  • Socket score

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

Moment

ISO 8601 based time and date module.

Installation

npm install --save @datatypes/moment

Usage

import Moment from '@datatypes/moment'

new Moment('2015-11-24T21:32:43Z')

Possible formats for the time-string (when a string can be interpreted as a date or a time, date takes precedence)

  1. Date

    • Millennium: '2'
    • Century: 20
    • Decade: 201
    • Year: 2015, 0002
    • Month: 2015-11
    • Week:
      • 2015-W48
      • 2015W48
    • Day:
      • 2015-11-24
      • 20151124
      • 2015-W48-2
      • 2015W482
      • 2015-328
      • 2015328
  2. Time

    • Minute:
      • 21:32
      • 2132
    • Second:
      • 21:32:43
      • 213243
    • Millisecond:
      • 21:32:43.654
      • 213243.654
  3. Datetime

    • <date>T<time>
    • <date> <time>

Methods

toObject

Returns a plain-object representation of the Moment instance. The lower limit is always inclusive and the upper limit exclusive.

new Moment('2015-11-24T21:37:42.123Z').toObject() === {
	string: '2015-11-24T21:37:42.123Z',
	lowerLimit: new Date('2015-11-24T21:37:42.123Z'),
	upperLimit: new Date('2015-11-24T21:37:42.124Z'),
	precision: 'millisecond'
}

toJSON

Returns a JSON representation of the Hour instance.

new Moment('2015-11-24').toJSON() === '{' +
	'"string":"2015-11-24",' +
	'"precision":"day",' +
	'"lowerLimit":"2015-11-24T00:00:00.000Z",' +
	'"upperLimit":"2015-11-25T00:00:00.000Z"' +
'}'

toString

Returns the ISO 8601 representation of the Hour instance.

new Moment('2015-11-24T21:37:42.123Z').toString() === '2015-11-24T21:37:42.123Z'

Keywords

FAQs

Package last updated on 12 Mar 2016

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