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

Propose get days from date functions #51

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

kweeuhree
Copy link
Collaborator

Description

This code adds a function getDateLastPurchasedOrDateCreated that takes in two Timestamps: dateLastPurchased and dateCreated. The function will check whether dateLastPurchased can be converted to a date, and if not it will return a valid date that the item was created.
Why adding:

  • I think that this function can help to abstract some OR logical checks.
    The name is hefty, so I appreciate any input here!

This code also proposes a getDaysFromDate function, that takes in a valid JS date and returns the amount of days that passed from that date until today.
Why adding:

  • Maybe can help simplify the calculatePurchaseUrgency function.

Related Issue

Related to issue 13

Type of Changes

enhancement

Updates

Screenshot 2024-09-19 154107

Testing Steps / QA Criteria

Ensured that calculateDateNextPurchased still works with the new abstraction

@kweeuhree kweeuhree added the enhancement New feature or request label Sep 19, 2024
Copy link

Visit the preview URL for this PR (updated for commit 57119a5):

https://tcl-75-smart-shopping-list--pr51-propose-get-days-fro-1f99qlcy.web.app

(expires Thu, 26 Sep 2024 19:55:30 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 1f1fd53c369e1fa31e15c310aa075b4e8f4f8dde

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants