Skip to content

Comments

feat: add get_pet_age function with tests (#97)#172

Merged
llinsss merged 3 commits intoDogStark:mainfrom
dreamgene:feature/97-pet-age-calculation-helper
Feb 23, 2026
Merged

feat: add get_pet_age function with tests (#97)#172
llinsss merged 3 commits intoDogStark:mainfrom
dreamgene:feature/97-pet-age-calculation-helper

Conversation

@dreamgene
Copy link
Contributor

Summary

Closes #97

Changes

  • Added get_pet_age(pet_id: u64) -> (u64, u64) to stellar-contracts/src/lib.rs
  • Uses env.ledger().timestamp() for current time
  • Returns (years, months) tuple calculated from pet.birthday
  • Returns (0, 0) for non-existent pets or future birthdays

Tests Added

  • test_age_calculation — verifies correct year/month output
  • test_age_edge_cases — verifies non-existent pet and edge timestamps

@llinsss llinsss merged commit 5485b9e into DogStark:main Feb 23, 2026
1 of 4 checks 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.

Add Pet Age Calculation Helper

2 participants