summaryrefslogtreecommitdiff
path: root/std/datetime
diff options
context:
space:
mode:
Diffstat (limited to 'std/datetime')
-rw-r--r--std/datetime/mod.ts10
-rw-r--r--std/datetime/test.ts4
2 files changed, 7 insertions, 7 deletions
diff --git a/std/datetime/mod.ts b/std/datetime/mod.ts
index 2afddbe6f..72f8cc681 100644
--- a/std/datetime/mod.ts
+++ b/std/datetime/mod.ts
@@ -84,13 +84,13 @@ export function weekOfYear(date: Date): number {
}
/**
- * Parse a date to return a IMF formated string date
+ * Parse a date to return a IMF formatted string date
* RFC: https://tools.ietf.org/html/rfc7231#section-7.1.1.1
* IMF is the time format to use when generating times in HTTP
* headers. The time being formatted must be in UTC for Format to
* generate the correct format.
* @param date Date to parse
- * @return IMF date formated string
+ * @return IMF date formatted string
*/
export function toIMF(date: Date): string {
function dtPad(v: string, lPad = 2): string {
@@ -233,16 +233,16 @@ function calculateMonthsDifference(bigger: number, smaller: number): number {
const smallerDate = new Date(smaller);
const yearsDiff = biggerDate.getFullYear() - smallerDate.getFullYear();
const monthsDiff = biggerDate.getMonth() - smallerDate.getMonth();
- const calendarDiffrences = Math.abs(yearsDiff * 12 + monthsDiff);
+ const calendarDifferences = Math.abs(yearsDiff * 12 + monthsDiff);
const compareResult = biggerDate > smallerDate ? 1 : -1;
biggerDate.setMonth(
- biggerDate.getMonth() - compareResult * calendarDiffrences,
+ biggerDate.getMonth() - compareResult * calendarDifferences,
);
const isLastMonthNotFull = biggerDate > smallerDate
? 1
: -1 === -compareResult
? 1
: 0;
- const months = compareResult * (calendarDiffrences - isLastMonthNotFull);
+ const months = compareResult * (calendarDifferences - isLastMonthNotFull);
return months === 0 ? 0 : months;
}
diff --git a/std/datetime/test.ts b/std/datetime/test.ts
index 3e42365ca..0ff70603d 100644
--- a/std/datetime/test.ts
+++ b/std/datetime/test.ts
@@ -357,8 +357,8 @@ Deno.test({
name: "[std/datetime] difference",
fn(): void {
const denoInit = new Date("2018/5/14");
- const denoRelaseV1 = new Date("2020/5/13");
- let difference = datetime.difference(denoRelaseV1, denoInit, {
+ const denoReleaseV1 = new Date("2020/5/13");
+ let difference = datetime.difference(denoReleaseV1, denoInit, {
units: ["days", "months", "years"],
});
assertEquals(difference.days, 730);