Skip to content

1Password: Expose CreatedAt and UpdatedAt timestamps as DateTime on VaultItem#189

Merged
detunized merged 5 commits into
masterfrom
copilot/add-created-updated-dates
Nov 2, 2025
Merged

1Password: Expose CreatedAt and UpdatedAt timestamps as DateTime on VaultItem#189
detunized merged 5 commits into
masterfrom
copilot/add-created-updated-dates

Conversation

Copilot AI commented Nov 2, 2025

Copy link
Copy Markdown
Contributor
  • Add CreatedAt and UpdatedAt properties to Response.VaultItem class (internal model) as strings
  • Expose CreatedAt and UpdatedAt properties in public VaultItem class as non-nullable DateTime
  • Move parsing logic from JSON model to VaultItem.ParseDateTime method
  • Remove SafeDateTimeConverter - JSON model now simple string mapping
  • Properties return default(DateTime) for invalid/missing dates instead of null
  • Add backing fields (_createdAt, _updatedAt) to cache parsed dates
  • Add tests for parsing CreatedAt and UpdatedAt from JSON (as strings)
  • Add tests for VaultItem.ParseDateTime method (valid, null, empty, invalid)
  • Add tests for accessing CreatedAt and UpdatedAt on VaultItem (as DateTime)
  • Update version to 28.2.0 in PasswordManagerAccess.csproj
  • Update CHANGELOG.md with the new feature
  • Run all tests to ensure everything works (1815 tests pass)

Summary

Optimized date handling with lazy initialization:

  • Added _createdAt and _updatedAt backing fields
  • Dates are parsed once on first access and then cached
  • Uses null-coalescing assignment operator (??=) for lazy initialization
  • Consistent with other cached properties like _fields, _overview, _details
  • All tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>1Password: Created and Updated Dates</issue_title>
<issue_description>Hi there

I notice on the response data for a vault in 1Password included createdAt and updatedAt dates. These can easily be added to the data returned in the vault object. I need these dates for a project I am working on.

Image</issue_description>

<agent_instructions>make sure the tests are updated for this one. make sure to test the failures as well. this version should be bumped to one minor: x.y.z -> x.y+1.0. update the changelog and the csproj. don't merge the pr, let me review.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: detunized <245393+detunized@users.noreply.github.com>
Copilot AI changed the title [WIP] Add createdAt and updatedAt dates to vault data 1Password: Expose CreatedAt and UpdatedAt timestamps on VaultItem Nov 2, 2025
Copilot AI requested a review from detunized November 2, 2025 16:52

@detunized detunized left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The dates should be parsed and returned as a standard datetime object in.NET. It shouldn't be strings. make sure to verify and don't throw if the dates don't parse just in case they are garbage.

@detunized

Copy link
Copy Markdown
Owner

@copilot The dates should be parsed and returned as a standard datetime object in.NET. It shouldn't be strings. make sure to verify and don't throw if the dates don't parse just in case they are garbage.

Co-authored-by: detunized <245393+detunized@users.noreply.github.com>

Copilot AI commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

The dates should be parsed and returned as a standard datetime object in.NET. It shouldn't be strings. make sure to verify and don't throw if the dates don't parse just in case they are garbage.

Updated in commit d39fde7. The properties now return DateTime? instead of strings. Implemented a SafeDateTimeConverter that parses dates from ISO 8601 format and returns null for invalid or missing dates without throwing exceptions. All 1811 tests pass including a new test for invalid date handling.

@copilot The dates should be parsed and returned as a standard datetime object in.NET. It shouldn't be strings. make sure to verify and don't throw if the dates don't parse just in case they are garba...

Implemented in commit d39fde7. The CreatedAt and UpdatedAt properties now return DateTime? with safe parsing that doesn't throw on invalid input.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title 1Password: Expose CreatedAt and UpdatedAt timestamps on VaultItem 1Password: Expose CreatedAt and UpdatedAt timestamps as DateTime on VaultItem Nov 2, 2025
Copilot AI requested a review from detunized November 2, 2025 17:20
@detunized

Copy link
Copy Markdown
Owner

@copilot Make the DateTime properties non-nullable and rather use the default value. also move out the parsing from the model and JSON properties into the vault parsing code. make VaultItem.CreatedAt and UpdatedAt strings and parse later. json model should be as simple as possible and match the incoming format closely.

… parse in VaultItem

Co-authored-by: detunized <245393+detunized@users.noreply.github.com>

Copilot AI commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

@copilot Make the DateTime properties non-nullable and rather use the default value. also move out the parsing from the model and JSON properties into the vault parsing code. make VaultItem.CreatedAt ...

Updated in commit a704ffc. The implementation now:

  • Response.VaultItem has CreatedAt/UpdatedAt as simple strings (matching JSON format)
  • Public VaultItem properties are non-nullable DateTime
  • Parsing logic moved to VaultItem.ParseDateTime() method
  • Invalid/missing dates return default(DateTime) instead of null
  • SafeDateTimeConverter removed - JSON model kept simple

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Comment thread src/OnePassword/VaultItem.cs Outdated
public string Name => Overview.Title ?? "";
public string Description => Overview.AdditionalInfo ?? "";
public string Note => Details.Note ?? "";
public DateTime CreatedAt => ParseDateTime(_itemInfo.CreatedAt);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot add a backing field here and don't re-parse the date every time. make sure it is parsed once and then cached.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added in commit d573747. The properties now use backing fields _createdAt and _updatedAt with lazy initialization (??=) so dates are parsed once and then cached, consistent with other properties like _fields and _overview.

Co-authored-by: detunized <245393+detunized@users.noreply.github.com>

Copilot AI commented Nov 2, 2025

Copy link
Copy Markdown
Contributor Author

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • av-build-tel-api-v1.avaloniaui.net
    • Triggering command: dotnet exec --runtimeconfig /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/runtimeconfig.json /home/REDACTED/.nuget/packages/avalonia.buildservices/0.0.29/tools/netstandard2.0/Avalonia.BuildServices.Collector.dll (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@detunized detunized marked this pull request as ready for review November 2, 2025 19:01
@detunized detunized merged commit 446315d into master Nov 2, 2025
12 checks passed
@detunized detunized deleted the copilot/add-created-updated-dates branch November 2, 2025 19:04
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.

1Password: Created and Updated Dates

2 participants