
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
@bitty/format-date
Advanced tools
A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
@bitty/format-date
@bitty/format-date
is a small library (around 400 B when gziped & minified) to format JavaScript Date
object using same tokens as moment.
📦 Distributions in ESM, CommonJS, UMD and UMD minified formats.
⚡ Lightweight:
🔋 Bateries included:
🏷 Safe:
This library is published in the NPM registry and can be installed using any compatible package manager.
npm install @bitty/format-date --save
# For Yarn, use the command below.
yarn add @bitty/format-date
This module has a UMD bundle available through JSDelivr and Unpkg CDNs.
<!-- For UNPKG use the code below. -->
<script src="https://unpkg.com/@bitty/format-date"></script>
<!-- For JSDelivr use the code below. -->
<script src="https://cdn.jsdelivr.net/npm/@bitty/format-date"></script>
<script>
// UMD module is exposed through the "isNullish" global function.
console.log(formatDate);
//=> "[Function: formatDate]"
console.log(formatDate(new Date(), 'YYYY-MM-DD'));
//=> "2020-06-14"
</script>
@bitty/format-date
exports a function to format JavaScript Date
object using moment tokens.
import formatDate from '@bitty/format-date';
formatDate(new Date(), 'DD/MM/YYYY HH [hours] [and] mm [minutes].');
// I'm escaping "hours", "and" and "minutes" using same syntax as Moment.js.
Right now this lib supports the tokens below.
Token | Output | |
---|---|---|
Year | YY | 70 , 71 , ... 19 , 20 . |
YYYY | 1970 , 1971 , ... 2019 , 2020 . | |
Month | M | 1 , 2 , ... 11 , 12 . |
MM | 01 , 02 , ... 11 , 12 . | |
Day of Month | D | 1 , 2 , ... 30 , 31 . |
DD | 01 , 02 , ... 30 , 31 . | |
Hour | H | 1 , 2 , ... , 22 ,23 . |
HH | 01 , 02 , ... , 22 ,23 . | |
Minute | m | 1 , 2 , ... , 58 ,59 . |
mm | 01 , 02 , ... , 58 ,59 . | |
Second | s | 1 , 2 , ... , 58 ,59 . |
ss | 01 , 02 , ... , 58 ,59 . | |
AM/PM | A | AM , PM . |
a | am , pm . | |
Escape | [*] |
Released under MIT License.
FAQs
A small library (around 400 B when gziped & minified) to format JavaScript `Date` object using same tokens as moment.
The npm package @bitty/format-date receives a total of 22 weekly downloads. As such, @bitty/format-date popularity was classified as not popular.
We found that @bitty/format-date demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.