mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-08-25 15:59:38 +00:00
change month format from MM/YYYY to MM-YYYY
This commit is contained in:
@ -3,12 +3,12 @@ import { IsNotEmpty, IsOptional, IsUUID, Matches } from 'class-validator';
|
|||||||
|
|
||||||
export class BookingRequestDto {
|
export class BookingRequestDto {
|
||||||
@ApiProperty({
|
@ApiProperty({
|
||||||
description: 'Month in MM/YYYY format',
|
description: 'Month in MM-YYYY format',
|
||||||
example: '07/2025',
|
example: '07-2025',
|
||||||
})
|
})
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
@Matches(/^(0[1-9]|1[0-2])\/\d{4}$/, {
|
@Matches(/^(0[1-9]|1[0-2])\/\d{4}$/, {
|
||||||
message: 'Date must be in MM/YYYY format',
|
message: 'Date must be in MM-YYYY format',
|
||||||
})
|
})
|
||||||
month: string;
|
month: string;
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ export class BookingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async findAll({ month, space }: BookingRequestDto, project: string) {
|
async findAll({ month, space }: BookingRequestDto, project: string) {
|
||||||
const [monthNumber, year] = month.split('/').map(Number);
|
const [monthNumber, year] = month.split('-').map(Number);
|
||||||
const fromDate = new Date(year, monthNumber - 1, 1);
|
const fromDate = new Date(year, monthNumber - 1, 1);
|
||||||
const toDate = new Date(year, monthNumber, 0, 23, 59, 59);
|
const toDate = new Date(year, monthNumber, 0, 23, 59, 59);
|
||||||
return this.bookingEntityRepository.find({
|
return this.bookingEntityRepository.find({
|
||||||
|
Reference in New Issue
Block a user