Skip to content
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

fix: [ENG-1319] allow user to set explicit end time, round up end and duration to the nearest hour #70

Merged
merged 13 commits into from
Feb 16, 2025

Conversation

sigmachirality
Copy link
Member

@sigmachirality sigmachirality commented Feb 16, 2025

Fixes the error where a user sets an explicit duration for a buy order, and it doesn't end on an hour boundary. Rounds the end time/duration up to the next hour boundary.

Copy link

semanticdiff-com bot commented Feb 16, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  src/helpers/feature-flags.ts  100% smaller
  src/lib/tokens.ts  52% smaller
  src/checkVersion.ts  49% smaller
  src/index.ts  47% smaller
  src/helpers/units.ts  39% smaller
  src/lib/buy/index.tsx  27% smaller
  src/scripts/release.ts  14% smaller
  src/lib/login.ts  7% smaller
  src/lib/sell/index.tsx  3% smaller
  src/lib/posthog.ts  2% smaller
  .cursor/rules/cli.mdc Unsupported file format
  .github/workflows/ci.yml  0% smaller
  deno.json  0% smaller
  deno.lock Unsupported file format
  src/helpers/config.ts  0% smaller
  src/helpers/errors.ts  0% smaller
  src/helpers/urls.ts  0% smaller
  src/helpers/waitingForOrder.ts  0% smaller
  src/lib/balance.ts  0% smaller
  src/lib/clusters/clusters.tsx  0% smaller
  src/lib/contracts/index.tsx  0% smaller
  src/lib/dev.ts  0% smaller
  src/lib/me.ts  0% smaller
  src/lib/orders/index.tsx  0% smaller
  src/lib/upgrade.ts  0% smaller
  src/lib/vm.ts  0% smaller
  src/types/deno.d.ts  0% smaller

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR adds explicit end time setting and duration rounding functionality to the CLI, focusing on order management and improving type safety with Deno.

  • Added -e/--end option in src/lib/buy/index.tsx that conflicts with -d/--duration, ensuring exactly one is specified
  • Centralized date parsing in src/helpers/units.ts with new parseStartDate function that handles both string and Date inputs
  • Removed redundant orders_create endpoint from src/helpers/urls.ts, suggesting order creation flow changes
  • Added compiler option deno.ns in deno.json to support Deno's standard library features
  • Introduced coding guidelines in .cursor/rules/cli.mdc for consistent Node.js imports and API client usage

25 file(s) reviewed, 13 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +112 to +115
export function parseStartDate(startDate?: string | Date): Date {
if (startDate instanceof Date) return startDate;
const result = parseStartDateOrNow(startDate);
return result === "NOW" ? new Date() : result;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In an ideal world this would be called like coerceStartDateToDate but this is a pedantic nit

@sigmachirality sigmachirality merged commit 9edc9f2 into main Feb 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants