Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
ez-local-time
Advanced tools
This cut and dry speed demon of a Node.js module delivers your desired localized date and time. This codebase depends solely on the Javascript API. There are absolutely no dependent packages to keep up to date, just install and import/require ez-local-time and never deal with new Date
or Date.now()
again when trying to deal with local time or time zones. You provide the region and desired response format (time, date, or both) and get the local date/time.
The region parameter follows a logical protocol: County/City, i.e. America/New_York . Note: If a country or city is more than a single word, all words are capitalized and are separated by an underscore (as you can see above). For further reference on time zones and regions please refer to: Internet Assigned Numbers Authority: https://www.iana.org/time-zones Time Difference (to explore locations): https://www.zeitverschiebung.net/en/country/us
Install it via npm:
npm i ez-local-time
Note: If you are using ES6, think React, (import and not require) you must compile your application code before interacting with the ez-local-time module.
'use strict'
const localTime = require('ez-local-time')
/*
**
How To Use
**
const varName = localTime([region], [response])
**
Pacific => [region] : America/Los_Angeles
Mountain => [region] : America/Denver
Central => [region] : America/Chicago
East => [region] : America/New_York
**
Default => [region]: if the parameter is left blank or the parameter passed is a blank string defaults to UTC time
**
t => [response] : time only
time => [response] : time only
d => [response] : date only
date => [response] : date only
* => [response] : time and date
*/
const DenverDate = localTime('America/Denver', 'd')
//returns '1/24/2018'
const DenverTime = localTime('America/Denver', 'time')
//returns '10:30:24 AM'
const DenverDateAndTime = localTime('America/Denver', '*')
//returns '1/24/2018, 10:32:59 AM'
I am developing version 1.0.0 as a proof of concept. Many features have been placed in the ice box (for now). I am placing a developmental priority on compatibility with ES6, allowing the React.js community access to a basic local time library, aside from Moment.js. Additionally, am emphasis is placed on establishing defaults for the region parameter to reflect America's main four time zones. Expect those updates in version 2.0.0 by March 1, 2018. This is a community project, pull requests are welcome. Let's see where we can take this!
MIT
FAQs
The easiest way to deal with local times, dates, and time zones in JavaScript. No heavy API, like Moment.js, just local times, dates, and time zones using the JavaScript Date API.
The npm package ez-local-time receives a total of 1 weekly downloads. As such, ez-local-time popularity was classified as not popular.
We found that ez-local-time demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.