mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
refactor(std/datetime): remove currentDayOfYear (#7059)
This commit is contained in:
parent
015fa0bd41
commit
de1007fc6a
3 changed files with 3 additions and 23 deletions
|
@ -64,19 +64,14 @@ format(new Date(2019, 0, 20), "'today:' yyyy-MM-dd") // output : "today: 2019-01
|
|||
...
|
||||
```
|
||||
|
||||
### dayOfYear / currentDayOfYear
|
||||
### dayOfYear
|
||||
|
||||
- `dayOfYear()` - Returns the number of the day in the year.
|
||||
- `currentDayOfYear()` - Returns the number of the current day in the year.
|
||||
Returns the number of the day in the year.
|
||||
|
||||
```ts
|
||||
import {
|
||||
dayOfYear,
|
||||
currentDayOfYear,
|
||||
} from "https://deno.land/std/datetime/mod.ts";
|
||||
import { dayOfYear } from "https://deno.land/std/datetime/mod.ts";
|
||||
|
||||
dayOfYear(new Date("2019-03-11T03:24:00")); // output: 70
|
||||
currentDayOfYear(); // output: ** depends on when you run it :) **
|
||||
```
|
||||
|
||||
### weekOfYear
|
||||
|
|
|
@ -54,14 +54,6 @@ export function dayOfYear(date: Date): number {
|
|||
return Math.floor(diff / DAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of current day in year
|
||||
* @return Number of current day in year
|
||||
*/
|
||||
export function currentDayOfYear(): number {
|
||||
return dayOfYear(new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of the week in the year (ISO-8601)
|
||||
* @return Number of the week in year
|
||||
|
|
|
@ -113,13 +113,6 @@ Deno.test({
|
|||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[std/datetime] currentDayOfYear",
|
||||
fn: () => {
|
||||
assertEquals(datetime.dayOfYear(new Date()), datetime.currentDayOfYear());
|
||||
},
|
||||
});
|
||||
|
||||
Deno.test({
|
||||
name: "[std/datetime] weekOfYear",
|
||||
fn: () => {
|
||||
|
|
Loading…
Reference in a new issue