generated from react-component/footer
-
-
Notifications
You must be signed in to change notification settings - Fork 334
fix: disabledHours & feat: now work with step #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c12e7e2
fix: disabledHours works unexpectlly when using 12 hours & hour shoul…
07akioni 372432f
chore
07akioni 74fd67a
chore: typo fix
07akioni 5c0da62
feat: now button now works with step
07akioni 5a0c072
test: now with step
07akioni 495b536
chore: fix typo
07akioni 7425eee
refactor: setTime, use useMemo
07akioni 7f11450
test: dayjs & moment util test
07akioni db37cd3
chore
07akioni 5c9d614
refactor: set time
07akioni 33f9a13
test: setTime
07akioni de43ba3
feat: dev warning on step
07akioni e9fdbf7
fix: dev warning
07akioni d46d4d1
fix: dev warning
07akioni fbdc1f5
refactor: get lower bound time rather than closest time
07akioni 8b04a63
refactor: use rc-utils memo
07akioni 08cb22d
refactor: use shallowEqual
07akioni 3a76732
refactor
07akioni df42550
refactor: code styling
07akioni f40a105
test: warning on time step
07akioni 5c610ca
chore
07akioni 6577912
chore
07akioni 35967ee
chore: revert format
07akioni 11b9ff3
fix: compare length in time units comparition
07akioni f8e8d33
chore: revert dayjs util code
07akioni 5b23f36
chore: revert some useMemo to React.useMemo
07akioni 11f58b7
chore: revert code formatting
07akioni 2fb05da
perf: remove useless destructuring assignment
07akioni 9962d03
perf: flatten parameters
07akioni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,34 @@ | ||
import { GenerateConfig } from '../generate'; | ||
|
||
export function setTime<DateType>( | ||
generateConfig: GenerateConfig<DateType>, | ||
date: DateType, | ||
hour: number, | ||
minute: number, | ||
second: number, | ||
): DateType { | ||
let nextTime = generateConfig.setHour(date, hour); | ||
nextTime = generateConfig.setMinute(nextTime, minute); | ||
nextTime = generateConfig.setSecond(nextTime, second); | ||
07akioni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return nextTime; | ||
} | ||
|
||
export function getLowerBoundTime( | ||
hour: number, | ||
minute: number, | ||
second: number, | ||
hourStep: number, | ||
minuteStep: number, | ||
secondStep: number, | ||
): [number, number, number] { | ||
const lowerBoundHour = Math.floor(hour / hourStep) * hourStep; | ||
if (lowerBoundHour < hour) { | ||
return [lowerBoundHour, 60 - minuteStep, 60 - secondStep]; | ||
} | ||
const lowerBoundMinute = Math.floor(minute / minuteStep) * minuteStep; | ||
if (lowerBoundMinute < minute) { | ||
return [lowerBoundHour, lowerBoundMinute, 60 - secondStep]; | ||
} | ||
07akioni marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const lowerBoundSecond = Math.floor(second / secondStep) * secondStep; | ||
return [lowerBoundHour, lowerBoundMinute, lowerBoundSecond]; | ||
} |
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.