Skip to content

Commit 95f470e

Browse files
committed
version bump
1 parent c869937 commit 95f470e

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.0.95-beta-1",
3+
"version": "0.0.95-beta-5",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/DatePicker/DateTimePicker.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ import { DATE_PICKER_IDS, DATE_PICKER_PLACEHOLDER, customDayStyles } from './con
3232
import './datePicker.scss'
3333
import { ReactComponent as CalendarIcon } from '../../../Assets/Icon/ic-calendar.svg'
3434
import { DATE_TIME_FORMATS } from '../../../Common'
35+
import 'react-dates/initialize'
36+
import 'react-dates/lib/css/_datepicker.css'
3537

3638
const timePickerStyles = getTimePickerStyles()
3739

@@ -58,14 +60,16 @@ const DateTimePicker = ({
5860
setFocused(focused)
5961
}
6062
const handleDateChange = (event) => {
61-
onChange(updateDate(dateObject, event.toDate()))
63+
onChange(updateDate(dateObject, event?.toDate()))
6264
}
6365

6466
const handleTimeChange = (option) => {
6567
onChange(updateTime(dateObject, option.value))
6668
}
6769

68-
const isOutsideRange = (day) => moment(startDate).diff(day, 'days') >= 0
70+
// To disable dates before the end date
71+
const isOutsideRange = (day) => moment(startDate).diff(day, 'days') >= 1
72+
6973
return (
7074
<div>
7175
<label className={`form__label ${required ? 'dc__required-field' : ''}`} htmlFor={id}>

src/Shared/Components/DatePicker/utils.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@ export const updateTime = (currentDateObj: Date, timeString: string) => {
130130
* Updates the date in the given date object and returns the updated object
131131
*/
132132
export const updateDate = (currentDateObj: Date, newDate: Date) => {
133+
// In case of null date, it will return the same date
134+
if (!newDate) {
135+
return currentDateObj
136+
}
133137
const day = newDate.getDate()
134138
const month = newDate.getMonth()
135139
const fullYear = newDate.getFullYear()

0 commit comments

Comments
 (0)