-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Use test clock for the initial date in trial assigning
- Loading branch information
Showing
3 changed files
with
38 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
webapp/src/ee/billing/administration/subscriptions/components/AssignTrialDatePicker.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { T } from '@tolgee/react'; | ||
import { DateTimePickerField } from 'tg.component/common/form/fields/DateTimePickerField'; | ||
import React from 'react'; | ||
|
||
export const AssignTrialDatePicker = () => { | ||
return ( | ||
<DateTimePickerField | ||
formControlProps={{ | ||
'data-cy': 'administration-trial-end-date-field', | ||
sx: { mt: 1 }, | ||
}} | ||
dateTimePickerProps={{ | ||
disablePast: true, | ||
label: ( | ||
<T keyName="administration-subscription-assign-trial-end-date-field" /> | ||
), | ||
}} | ||
name="trialEnd" | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useTestClock } from 'tg.service/useTestClock'; | ||
|
||
export const useCurrentDate = () => { | ||
const testClock = useTestClock(); | ||
|
||
if (!testClock) { | ||
return new Date(); | ||
} | ||
|
||
return new Date(testClock); | ||
}; |