skip to Main Content

Why does toISOString() function convert Javascript’s Sat Apr 01 2023 00:00:00 GMT+0530 (India Standard Time) to the previous day?

const currentDate = new Date(); const lastMonthStartDate = new Date( currentDate.getFullYear(), currentDate.getMonth() - 1, 1 ); const lastMonthEndDate = new Date( currentDate.getFullYear(), currentDate.getMonth(), 0 ); from = lastMonthStartDate.toISOString().split("T")[0]; to = lastMonthEndDate.toISOString().split("T")[0]; console.log(lastMonthStartDate, lastMonthEndDate); console.log(from,"last month" ,to); while executing this I…

VIEW QUESTION

Can Reactjs test data endpoints?

Here I want to test the data output on the endpoint. My test: import { render, screen } from "@testing-library/react"; import axios from "axios"; import CompBuildingGeo from "./components/CompBuildingGeo"; import { getBuildingGEO } from "../../service/building"; const buildingGeo = async () =>…

VIEW QUESTION
Back To Top
Search