php-date-format
Advanced tools
@@ -15,3 +15,3 @@ "use strict"; | ||
| N: (d) => (d.getDay() || 7).toString(), | ||
| S: (d) => suffix[d.getDate()] ?? 'th', | ||
| S: (d) => Math.floor(d.getDate() / 10) !== 1 ? suffix[d.getDate() % 10] ?? 'th' : 'th', | ||
| w: (d) => d.getDay().toString(), | ||
@@ -18,0 +18,0 @@ z: (d) => Math.floor((d - new Date(d.getFullYear(), 0, 1)) / (1000 * 60 * 60 * 24)).toString(), |
+1
-1
@@ -12,3 +12,3 @@ { | ||
| ], | ||
| "version": "1.0.6", | ||
| "version": "1.0.7", | ||
| "license": "MIT", | ||
@@ -15,0 +15,0 @@ "type": "module", |
@@ -66,2 +66,4 @@ import { createRequire } from 'module'; | ||
| }); | ||
| // week number and week-numbering year | ||
| it('should be next year\'s week number', function () { | ||
@@ -85,11 +87,27 @@ assert.equal(format('W', new Date('2013-12-31')), '01'); | ||
| }); | ||
| // English suffix | ||
| it('should be 1st', function () { | ||
| assert.equal(format('S', new Date('2024-01-01')), 'st'); | ||
| assert.equal(format('jS', new Date('2024-01-01')), '1st'); | ||
| }); | ||
| it('should be 3rd', function () { | ||
| assert.equal(format('S', new Date('2024-01-03')), 'rd'); | ||
| assert.equal(format('jS', new Date('2024-01-03')), '3rd'); | ||
| }); | ||
| it('should be 4th', function () { | ||
| assert.equal(format('S', new Date('2024-01-04')), 'th'); | ||
| assert.equal(format('jS', new Date('2024-01-04')), '4th'); | ||
| }); | ||
| it('should be 11th', function () { | ||
| assert.equal(format('jS', new Date('2024-01-11')), '11th'); | ||
| }); | ||
| it('should be 21st', function () { | ||
| assert.equal(format('jS', new Date('2024-01-21')), '21st'); | ||
| }); | ||
| it('should be 24th', function () { | ||
| assert.equal(format('jS', new Date('2024-01-24')), '24th'); | ||
| }); | ||
| it('should be 31st', function () { | ||
| assert.equal(format('jS', new Date('2024-01-31')), '31st'); | ||
| }); | ||
| // year's sign | ||
| it('should return minus year', function () { | ||
@@ -104,2 +122,4 @@ assert.equal(format('X', new Date('2024-01-01').setYear(-55)), '-0055'); | ||
| }); | ||
| // summar time | ||
| it('should return summer time flag', function () { | ||
@@ -106,0 +126,0 @@ process.env.TZ = 'Europe/London', |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
12763
4.78%281
6.04%