React Suite DatePicker Usage ISO week
React Suite is a front-end UI library that consists of a set of React components developed by keeping developers in mind. It is a well-thought-out and developer-friendly library. In this article, we will be seeing React Suite DatePicker Usage ISO week. The DatePicker Component is used to take the input of date and time from the users.
According to International Organisation for Standardization (ISO), each calendar week begins with Monday as starting day and ends with Sunday as the last day of the week. The calendar panel of the DatePicker component can be displayed according to ISO standards by using the isoWeek property.
React Suite DatePicker Usage ISO Week Components:
- DatePicker: The DatePicker component selects or inputs the date and/or time.
React Suite DatePicker Usage ISO Week Attributes/Props:
- isoWeek: It is a boolean attribute of the DatePicker component used to show the calendar panel according to the ISO standards.
- size: THis property of the DatePicker component is used to set the size of the component. It accept four values: “xs”, “sm”, “md”, and “lg”.
<DatePicker isoWeek />
Creating The React Application And Installing React Suite in the Project:
Step 1: Create the React application using the npx command:
npx create-react-app foldername
Step 2: After creating the project folder, move to it using the cd command:
Step 3: After creating the ReactJS application, Install the rsuite module so that we can use the DatePicker component using the following command:
npm install rsuite
After following the above steps, the project structure will look like this:
Let’s see some examples to understand how to use the React Suite DatePicker isoWeek attribute/prop.
Example 1: Now replace the code in the App.js file with the code below. In this example, we used the isoWeek attribute on the DatePicker component to show its calendar panel in accordance with ISO standards.
Run the Application: Run your app using the following command from the root directory of the project.
Output: Go to http://localhost:3000/ in your browser to see the output.
Example 2: In the example below, we used the size property of the DatePicker component along with isoWeek property to change the size of the Datepickers.