Allowing creation of timesheet records with begin and end time#26
Open
vworldat wants to merge 1 commit into
Open
Allowing creation of timesheet records with begin and end time#26vworldat wants to merge 1 commit into
vworldat wants to merge 1 commit into
Conversation
kevinpapst
approved these changes
Jan 5, 2026
kevinpapst
left a comment
Member
There was a problem hiding this comment.
I did not test it, but look good to me.
Thanks @vworldat 👍
There was a problem hiding this comment.
Pull request overview
Adds support for creating timesheet records with explicit begin/end timestamps via the kimai start command, enabling scripted/bulk inserts and “forgot to start/stop” workflows discussed in #7 and parts of #8.
Changes:
- Added
--begin/-band--end/-eoptions tokimai start, with interactive refinement for invalid date inputs. - Updated CLI output to include an optional
Endtimestamp. - Added PHPStan baseline configuration to suppress a nullsafe-call finding originating from upstream API typings.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Command/TimesheetCommandTrait.php | Adds a helper for parsing DateTime values (currently implemented recursively). |
| src/Command/StartCommand.php | Introduces --begin/--end options, parses them into the form, and prints End in output. |
| README.md | Documents new --begin/--end options with examples and refinement prompt behavior. |
| phpstan.neon | Includes the baseline file in PHPStan configuration. |
| phpstan-baseline.neon | Suppresses a specific PHPStan nullsafe-call rule for StartCommand.php. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
26
to
29
| ->setName('start') | ||
| ->setDescription('Starts a new timesheet') | ||
| ->setHelp('This command lets you start a new timesheet') | ||
| ->setHelp('This command lets you start a new timesheet and optionally end it immediately.') | ||
| ->addOption('customer', 'c', InputOption::VALUE_OPTIONAL, 'The customer to filter the project list, can be an ID or a search term or empty (you will be prompted for a customer).') |
Comment on lines
+325
to
+340
| /** | ||
| * Try to convert the given string into a DateTime object and recursively ask for clarification if necessary. | ||
| */ | ||
| private function parseAndRefineDateTime(SymfonyStyle $io, string $begin, string $valueName): \DateTime | ||
| { | ||
| try { | ||
| return new \DateTime($begin); | ||
| } catch (\Exception $e) { | ||
| } | ||
|
|
||
| return $this->parseAndRefineDateTime( | ||
| $io, | ||
| $io->ask(\sprintf('Value "%s" for field "%s" is not a valid DateTime. Please refine:', $begin, $valueName), $begin), | ||
| $valueName, | ||
| ); | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
I added
--begin/-band--end/-eoptions to thekimai startcommand. This would resolve both #7 as well as parts of #8 (no--endoption forkimai stopyet).Had to add a phpstan baseline to ignore errors caused by
kimai/api-phpdeclaring nullable getters as non-nullable.