Socket
Socket
Sign inDemoInstall

@financial-times/ft-date-format

Package Overview
Dependencies
Maintainers
16
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/ft-date-format - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

6

index.js

@@ -26,2 +26,3 @@ const months = '["' + 'January,February,March,April,May,June,July,August,September,October,November,December'.split(',').join('","') + '"]';

dd: 'pad2(date.getDate())', // 04
do: 'ordinal(date.getDate())', // 4th
m: 'date.getMinutes()', // 5

@@ -50,2 +51,7 @@ mm: 'pad2(date.getMinutes())', // 05

funcString += 'function pad2 (number) {return ("0" + number).slice(-2)}';
funcString += `function ordinal(number) {
const suffixes = ["th", "st", "nd", "rd"];
const v = number % 100;
return number + (suffixes[(v - 20) % 10] || suffixes[v] || suffixes[0]);
}`;
funcString += 'return "' + tpl.replace(/\\?[a-z]+/ig, function (match) {

@@ -52,0 +58,0 @@ if (match.charAt(0) === '\\') {

@@ -92,2 +92,12 @@ /* eslint-env mocha */

it('returns ordinals formatted correctly', () => {
const days = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th', '8th', '9th', '10th',
'11th', '12th', '13th', '14th', '15th', '16th', '17th', '18th', '19th', '20th',
'21st', '22nd', '23rd', '24th', '25th', '26th', '27th', '28th', '29th', '30th', '31st'];
for (let i = 1; i <= days.length; i++) {
proclaim.strictEqual(ftDateFormat.format(new Date(2000, 0, i), 'do'), days[i - 1]);
}
});
it('returns an unpadded 12hour clock value for `h` format', () => {

@@ -94,0 +104,0 @@ proclaim.strictEqual(ftDateFormat.format(someTimes["midnight"], 'h'), '12');

2

package.json
{
"name": "@financial-times/ft-date-format",
"version": "1.0.1",
"version": "1.0.2",
"description": "Utility for formatting and updating dates for Financial-Times customer-facing products",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

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