Skip to content

Commit

Permalink
Update to 2024b. (#45)
Browse files Browse the repository at this point in the history
* Updated to 2023d. Fixed testing to account for updated date formats.

* Updated to 2024a.

* Updated to 2024b.

* Updated to 2024b, part 2.
  • Loading branch information
kshetline authored Sep 7, 2024
1 parent 84b3c6b commit 1ae3dd8
Show file tree
Hide file tree
Showing 10 changed files with 3,809 additions and 9,170 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,18 @@ For example:

## Moment.js-style localized formats

| | Token | Output |
| -------|------:|------- |
| Month name, day of month, day of week, year, time | LLLL | Thursday, September 4, 1986 8:30 PM |
| | llll | Thu, Sep 4, 1986 8:30 PM |
| Month name, day of month, year, time | LLL | September 4, 1986 8:30 PM |
| | lll | Sep 4, 1986 8:30 PM |
| Month name, day of month, year | LL | September 4, 1986 |
| | ll | Sep 4, 1986 |
| Month numeral, day of month, year | L | 09/04/1986 |
| | l | 9/4/1986 |
| Time with seconds | LTS | 8:30:25 PM |
| Time | LT | 8:30 PM |
| | Token | Output |
| -------|------:|-----------------------------------------|
| Month name, day of month, day of week, year, time | LLLL | Thursday, September 4, 1986 at 8:30 PM |
| | llll | Thu, Sep 4, 1986 8:30 PM |
| Month name, day of month, year, time | LLL | September 4, 1986 8:30 PM |
| | lll | Sep 4, 1986 8:30 PM |
| Month name, day of month, year | LL | September 4, 1986 |
| | ll | Sep 4, 1986 |
| Month numeral, day of month, year | L | 09/04/1986 |
| | l | 9/4/1986 |
| Time with seconds | LTS | 8:30:25 PM |
| Time | LT | 8:30 PM |

## @tubular/time `Intl.DateTimeFormat` shorthand string formats

Expand Down
11,523 changes: 3,081 additions & 8,442 deletions package-lock.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tubular/time",
"version": "3.8.15",
"version": "3.9.2",
"description": "Date/time, IANA timezones, leap seconds, TAI/UTC conversions, calendar with settable Julian/Gregorian switchover",
"main": "dist/cjs/index.js",
"module": "dist/fesm2015/index.js",
Expand Down Expand Up @@ -46,15 +46,15 @@
"author": "Kerry Shetline <[email protected]>",
"license": "MIT",
"dependencies": {
"@tubular/math": "^3.2.0",
"@tubular/util": "^4.13.1"
"@tubular/math": "^3.3.1",
"@tubular/util": "^4.16.1"
},
"optionalDependencies": {
"by-request": "^1.3.3",
"by-request": "^1.3.4",
"json-z": "^3.3.2"
},
"devDependencies": {
"@babel/core": "^7.17.10",
"@babel/core": "^7.23.6",
"@babel/preset-env": "^7.17.10",
"@babel/register": "^7.17.7",
"@rollup/plugin-typescript": "^8.3.2",
Expand All @@ -72,7 +72,7 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"mocha": "^9.2.2",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.71.1",
Expand Down
6 changes: 3 additions & 3 deletions src/format-parse.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('FormatParse', () => {
expect(new DateTime('20212-06-04').format('Y-MM-DD')).to.equal('+20212-06-04');
expect(new DateTime('1986-09-04T20:30:03').format('yyyy-MMM-DD, hh:mm A')).to.equal('1986-Sep-04, 08:30 PM');
expect(new DateTime('1986-09-04T20:30:03').format('LTS')).to.equal('8:30:03 PM');
expect(new DateTime('1986-09-04T20:30:03').format('LLLL')).to.equal('Thursday, September 4, 1986, 8:30 PM');
expect(new DateTime('1986-09-04T20:30:03').format('LLLL')).to.equal('Thursday, September 4, 1986 at 8:30 PM');
expect(new DateTime('1986-09-04T20:30:03').format('ILS')).to.equal('September 4, 1986 at 8:30 PM');
expect(new DateTime('1986-09-04T20:30:03 America/New_York').format('IxL')).to.equal('8:30:03 PM EDT');
expect(new DateTime('1986-09-04T20:30:03Z').format('IxL')).to.equal('8:30:03 PM UTC');
Expand All @@ -45,8 +45,8 @@ describe('FormatParse', () => {
expect(new DateTime('1986-09-04').toLocale(['qq', 'fr']).format('IS')).to.equal('04/09/1986');
expect(new DateTime('1986-09-04').format('D\u200F/M\u200F/YYYY h:mm A', 'ar')).to.equal('٤\u200F/٩\u200F/١٩٨٦ ١٢:٠٠ ص');
expect(new DateTime('1986-09-04').format('D/M/YY h:mm A', 'bn')).to.equal('৪/৯/৮৬ ১২:০০ AM');
expect(new DateTime('1986-09-04').format('ISS', 'bn')).to.equal('৪/৯/৮৬ ১২:০০ AM');
expect(new DateTime('1986-09-04').format('ISS{numberingSystem:latn}', 'bn')).to.equal('4/9/86 12:00 AM');
expect(new DateTime('1986-09-04').format('ISS', 'bn')).to.equal('৪/৯/৮৬, ১২:০০ AM');
expect(new DateTime('1986-09-04').format('ISS{numberingSystem:latn}', 'bn')).to.equal('4/9/86, 12:00 AM');
expect(new DateTime('1986-09-04').format('DD-MM-YY နံနက် H:mm', 'my')).to.equal('၀၄-၀၉-၈၆ နံနက် ၀:၀၀');
});

Expand Down
4 changes: 2 additions & 2 deletions src/format-parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,9 @@ function generatePredefinedFormats(locale: ILocale, timezone: string): void {
});
}
else {
locale.dateTimeFormats.LLLL = 'dddd, MMMM D, YYYY h:mm A'; // Thursday, September 4, 1986 8:30 PM
locale.dateTimeFormats.LLLL = 'dddd, MMMM D, YYYY at h:mm A'; // Thursday, September 4, 1986 8:30 PM
locale.dateTimeFormats.llll = 'ddd, MMM D, YYYY h:mm A'; // Thu, Sep 4, 1986 8:30 PM
locale.dateTimeFormats.LLL = 'MMMM D, YYYY h:mm A'; // September 4, 1986 8:30 PM
locale.dateTimeFormats.LLL = 'MMMM D, YYYY at h:mm A'; // September 4, 1986 8:30 PM
locale.dateTimeFormats.lll = 'MMM D, YYYY h:mm A'; // Sep 4, 1986 8:30 PM
locale.dateTimeFormats.LTS = 'h:mm:ss A'; // 8:30:25 PM
locale.dateTimeFormats.LT = 'h:mm A'; // 8:30 PM
Expand Down
8 changes: 4 additions & 4 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ describe('Zone updates', () => {
expect(ttime('May 8, 1945 UTC', 'MMM D, Y z').epochMillis).to.equal(Date.parse('May 8, 1945 00:00+00:00'));
expect(ttime('8/5/1945', 'IS', 'es').format('IM')).to.match(/^8 may\.? 1945$/);
expect(ttime('8/5/45', 'IS', 'es').format('IM')).to.match(/^8 may\.? 2045$/);
expect(ttime('2/5/1955 03:12 am', 'ISS').format('LLLL')).to.equal('Saturday, February 5, 1955, 3:12 AM');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('LLLL')).to.equal('Saturday, February 5, 1955 at 3:12 AM');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('llll')).to.equal('Sat, Feb 5, 1955, 3:12 AM');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('LLL')).to.equal('February 5, 1955, 3:12 AM');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('LLL')).to.equal('February 5, 1955 at 3:12 AM');
expect(ttime([1955, 2, 5, 3, 12]).format('lll')).to.equal('Feb 5, 1955, 3:12 AM');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('LL')).to.equal('February 5, 1955');
expect(ttime('2/5/1955 03:12 am', 'ISS').format('ll')).to.equal('Feb 5, 1955');
Expand Down Expand Up @@ -110,9 +110,9 @@ describe('Zone updates', () => {
});

it('should be able to create DateTimeFormat instances without dateStyle/timeStyle exceptions', () => {
expect(() => newDateTimeFormat('fr', { timeStyle: 'short', hour: '2-digit' })).to.not.throw();
expect(() => newDateTimeFormat('fr', { timeStyle: 'short', hour: '2-digit' } as any)).to.not.throw();

const options = newDateTimeFormat('en-US', { dateStyle: 'short', era: 'short' }).resolvedOptions();
const options = newDateTimeFormat('en-US', { dateStyle: 'short', era: 'short' } as any).resolvedOptions();

expect(options.era).to.equal('short');
expect((options as any).dateStyle).to.be.undefined;
Expand Down
Loading

0 comments on commit 1ae3dd8

Please sign in to comment.