Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some urls in the codebase #3751

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/i18nContributionGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ To add a new locale:
- Copy the content of an existing locale (e.g. `en-US`) into the newly created directory.

- Replace the values in the content with yours file-by-file.
Use [CLDR data](https://www.unicode.org/cldr/charts/32/summary/root.html)
Use [CLDR data](https://www.unicode.org/cldr/charts/44/summary/root.html)
as a point of reference which values to choose.

All locales contain a number of properties:
Expand Down
2 changes: 1 addition & 1 deletion src/_lib/format/lightFormatters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { addLeadingZeros } from "../../addLeadingZeros/index.js";
export const lightFormatters = {
// Year
y(date: Date, token: string): string {
// From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
// From https://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_tokens
// | Year | y | yy | yyy | yyyy | yyyyy |
// |----------|-------|----|-------|-------|-------|
// | AD 1 | 1 | 01 | 001 | 0001 | 00001 |
Expand Down
2 changes: 1 addition & 1 deletion src/_lib/protectedTokens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ export function warnOrThrowProtectedError(

function message(token: string, format: string, input: string) {
const subject = token[0] === "Y" ? "years" : "days of the month";
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md`;
}
2 changes: 1 addition & 1 deletion src/addISOWeekYears/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { setISOWeekYear } from "../setISOWeekYear/index.js";
* @description
* Add the specified number of ISO week-numbering years to the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/differenceInCalendarISOWeekYears/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { getISOWeekYear } from "../getISOWeekYear/index.js";
* @description
* Get the number of calendar ISO week-numbering years between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/differenceInCalendarISOWeeks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getTimezoneOffsetInMilliseconds } from "../_lib/getTimezoneOffsetInMill
* @description
* Get the number of calendar ISO weeks between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/differenceInISOWeekYears/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { toDate } from "../toDate/index.js";
* @description
* Get the number of full ISO week-numbering years between the given dates.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/endOfISOWeek/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { endOfWeek } from "../endOfWeek/index.js";
* Return the end of an ISO week for the given date.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/endOfISOWeekYear/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { constructFrom } from "../constructFrom/index.js";
* which always starts 3 days before the year's first Thursday.
* The result will be in the local timezone.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
14 changes: 7 additions & 7 deletions src/format/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface FormatOptions
* Return the formatted date string in the given format. The result may vary by locale.
*
* > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
* > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* > See: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
*
* The characters wrapped between two single quotes characters (') are escaped.
* Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
Expand Down Expand Up @@ -301,10 +301,10 @@ export interface FormatOptions
* - `p`: long localized time
*
* 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
*
* 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand All @@ -317,10 +317,10 @@ export interface FormatOptions
* @throws `date` must not be Invalid Date
* @throws `options.locale` must contain `localize` property
* @throws `options.locale` must contain `formatLong` property
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
* @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
* @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
* @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
* @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md
* @throws format string contains an unescaped latin alphabet character
*
* @example
Expand Down
46 changes: 29 additions & 17 deletions src/format/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ describe("format", () => {

it("alias formatDate has same behavior as format", () => {
const date = new Date(2014, 3, 4, 5);
expect(formatDate(date, "yyyy-MM-dd'\n'HH:mm:ss")).toBe(format(date, "yyyy-MM-dd'\n'HH:mm:ss"));
expect(formatDate(date, "yyyy-MM-dd'\n'HH:mm:ss")).toBe(
format(date, "yyyy-MM-dd'\n'HH:mm:ss"),
);
});

describe("ordinal numbers", () => {
Expand Down Expand Up @@ -507,20 +509,24 @@ describe("format", () => {

it("12 PM", () => {
const date = new Date(1986, 3 /* Apr */, 4, 12, 0, 0, 900);
expect(format(date, "b bb bbb bbbb bbbbb")).toBe("noon noon noon noon n");
expect(format(date, "b bb bbb bbbb bbbbb")).toBe(
"noon noon noon noon n",
);
});

it("12 AM", () => {
const date = new Date(1986, 3 /* Apr */, 6, 0, 0, 0, 900);
expect(format(date, "b bb bbb bbbb bbbbb")).toBe("midnight midnight midnight midnight mi");
expect(format(date, "b bb bbb bbbb bbbbb")).toBe(
"midnight midnight midnight midnight mi",
);
});
});

describe("flexible day periods", () => {
it("works as expected", () => {
const result = format(date, "B, BB, BBB, BBBB, BBBBB");
expect(result).toBe(
"in the morning, in the morning, in the morning, in the morning, in the morning"
"in the morning, in the morning, in the morning, in the morning, in the morning",
);
});

Expand Down Expand Up @@ -626,7 +632,9 @@ describe("format", () => {

getTimezoneOffsetStub.returns(450);
const resultNegative30Offset = format(date, "O OO OOO OOOO");
expect(resultNegative30Offset).toBe("GMT-7:30 GMT-7:30 GMT-7:30 GMT-07:30");
expect(resultNegative30Offset).toBe(
"GMT-7:30 GMT-7:30 GMT-7:30 GMT-07:30",
);

getTimezoneOffsetStub.restore();
});
Expand Down Expand Up @@ -718,7 +726,9 @@ describe("format", () => {

it("full date + time", () => {
const result = format(date, "PPPPpppp");
expect(result).toBe("Friday, April 4th, 1986 at 10:32:55 AM " + timezoneGMT);
expect(result).toBe(
"Friday, April 4th, 1986 at 10:32:55 AM " + timezoneGMT,
);
});

it("allows arbitrary combination of date and time", () => {
Expand All @@ -729,7 +739,9 @@ describe("format", () => {

describe("edge cases", () => {
it("throws RangeError if the time value is invalid", () => {
expect(format.bind(null, new Date(NaN), "MMMM d, yyyy")).toThrow(RangeError);
expect(format.bind(null, new Date(NaN), "MMMM d, yyyy")).toThrow(
RangeError,
);
});

it("handles dates before 100 AD", () => {
Expand Down Expand Up @@ -869,7 +881,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `d` instead of `D` (in `yyyy-MM-D`) for formatting days of the month to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -882,7 +894,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `dd` instead of `DD` (in `yyyy-MM-DD`) for formatting days of the month to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -895,7 +907,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `ddd` instead of `DDD` (in `yyyy-MM-DDD`) for formatting days of the month to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -908,7 +920,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `dddd` instead of `DDDD` (in `yyyy-MM-DDDD`) for formatting days of the month to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -921,7 +933,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `ddddd` instead of `DDDDD` (in `yyyy-MM-DDDDD`) for formatting days of the month to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -934,7 +946,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `y` instead of `Y` (in `Y-MM-dd`) for formatting years to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -947,7 +959,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `yy` instead of `YY` (in `YY-MM-dd`) for formatting years to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -960,7 +972,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `yyy` instead of `YYY` (in `YYY-MM-dd`) for formatting years to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -973,7 +985,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `yyyy` instead of `YYYY` (in `YYYY-MM-dd`) for formatting years to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});

Expand All @@ -986,7 +998,7 @@ describe("format", () => {
expect(warn).toBeCalledWith(
"Use `yyyyy` instead of `YYYYY` (in `YYYYY-MM-dd`) for formatting years to the input `" +
date +
"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md",
"`; see: https://github.com/date-fns/date-fns/blob/main/docs/unicodeTokens.md",
);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/getISODay/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { toDate } from "../toDate/index.js";
* Get the day of the ISO week of the given date,
* which is 7 for Sunday, 1 for Monday etc.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/getISOWeek/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { toDate } from "../toDate/index.js";
* @description
* Get the ISO week of the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/getISOWeekYear/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { toDate } from "../toDate/index.js";
* Get the ISO week-numbering year of the given date,
* which always starts 3 days before the year's first Thursday.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down
2 changes: 1 addition & 1 deletion src/getISOWeeksInYear/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { startOfISOWeekYear } from "../startOfISOWeekYear/index.js";
* @description
* Get the number of weeks in an ISO week-numbering year of the given date.
*
* ISO week-numbering year: http://en.wikipedia.org/wiki/ISO_week_date
* ISO week-numbering year: https://en.wikipedia.org/wiki/ISO_week_date
*
* @typeParam DateType - The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
*
Expand Down