mirror of
https://github.com/TomasiDeveloping/PlayerManagement.git
synced 2026-04-16 09:12:20 +00:00
fix week pipe bug
This commit is contained in:
parent
4efec5642e
commit
9ba4189a0d
9
Ui/package-lock.json
generated
9
Ui/package-lock.json
generated
@ -24,6 +24,7 @@
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"bootswatch": "^5.3.3",
|
||||
"jest-editor-support": "*",
|
||||
"moment": "^2.30.1",
|
||||
"ngx-pagination": "^6.0.3",
|
||||
"ngx-spinner": "^17.0.0",
|
||||
"ngx-toastr": "^19.0.0",
|
||||
@ -10701,6 +10702,14 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/moment": {
|
||||
"version": "2.30.1",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz",
|
||||
"integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/mrmime": {
|
||||
"version": "2.0.0",
|
||||
"dev": true,
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
"bootstrap-icons": "^1.11.3",
|
||||
"bootswatch": "^5.3.3",
|
||||
"jest-editor-support": "*",
|
||||
"moment": "^2.30.1",
|
||||
"ngx-pagination": "^6.0.3",
|
||||
"ngx-spinner": "^17.0.0",
|
||||
"ngx-toastr": "^19.0.0",
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import {Pipe, PipeTransform} from '@angular/core';
|
||||
import moment from "moment";
|
||||
|
||||
@Pipe({
|
||||
name: 'week'
|
||||
@ -6,11 +7,6 @@ import { Pipe, PipeTransform } from '@angular/core';
|
||||
export class WeekPipe implements PipeTransform {
|
||||
|
||||
transform(value: Date, ...args: unknown[]): unknown {
|
||||
const d = new Date(value);
|
||||
let yearStart = +new Date(d.getFullYear(), 0, 1);
|
||||
let today = +new Date(d.getFullYear(),d.getMonth(),d.getDate());
|
||||
let dayOfYear = ((today - yearStart + 1) / 86400000);
|
||||
return Math.ceil(dayOfYear / 7);
|
||||
return moment(value).isoWeek();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user