Skip to content

Commit

Permalink
Copy updates and conversion simplification (#1936)
Browse files Browse the repository at this point in the history
  • Loading branch information
cameron-eyds authored Jun 14, 2024
1 parent 14a3652 commit ab49e52
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
id="proceedings-option"
class="radio-two"
:class="{'selected-radio': securitiesActNoticeType === SaNoticeTypes.NOTICE_OF_PROCEEDINGS}"
label="Proceedings"
label="Order or Proceedings"
:value="SaNoticeTypes.NOTICE_OF_PROCEEDINGS"
/>
</v-radio-group>
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/enums/registrationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export enum APIRegistrationTypes {
export enum UIRegistrationTypes {
// standard
SECURITY_AGREEMENT = 'Security Agreement',
SECURITY_ACT_NOTICE = 'Securities Order or Proceedings Notice',
SECURITY_ACT_NOTICE = 'Securities Order or Proceeding',
REPAIRERS_LIEN = 'Repairers Lien',
MARRIAGE_MH = 'Marriage / Separation Agreement affecting Manufactured Home under Family Law Act',
SALE_OF_GOODS = 'Possession under S.30 of the Sale of Goods Act',
Expand Down
2 changes: 1 addition & 1 deletion ppr-ui/src/enums/securityActNotice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export enum SaNoticeTypes {

export enum SaNoticeTypesUI {
NOTICE_OF_LIEN = 'Notice of Lien and Charge',
NOTICE_OF_PROCEEDINGS = 'Notice of Proceedings'
NOTICE_OF_PROCEEDINGS = 'Notice of Order or Proceedings'
}

export const saNoticeTypeMapping: Record<SaNoticeTypes, SaNoticeTypesUI> = {
Expand Down
29 changes: 2 additions & 27 deletions ppr-ui/src/utils/date-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,37 +270,12 @@ export const isWithinMinutes = (createDateTime: string, minuteDifferential: numb

/**
* Converts a date string to an ISO 8601 date-time string representing the last minute of the day.
* The returned string includes local timezone information.
*
* @param {string} dateStr - The date string in the format 'YYYY-MM-DD'.
* @returns {string} - An ISO 8601 date-time string representing the last minute of the specified day.
*
* @example
* // Example usage:
* const dateStr = '2024-05-26'
* Input: 2024-05-26
* Output: 2024-05-26T23:59:59+00:00
*/
export function convertToISO8601LastMinute(dateStr: string): string {
// Parse the date string to create a Date object
const date = new Date(dateStr + 'T00:00:00-00:00')

// Set the time to the last minute of the day (23:59:59)
date.setHours(23, 59, 59, 999)

// Get the timezone offset in minutes
const timezoneOffset = -date.getTimezoneOffset()
const offsetSign = timezoneOffset >= 0 ? '+' : '-'
const offsetHours = String(Math.floor(Math.abs(timezoneOffset) / 60)).padStart(2, '0')
const offsetMinutes = String(Math.abs(timezoneOffset) % 60).padStart(2, '0')

// Format the date parts
const year = date.getFullYear()
const month = String(date.getMonth() + 1).padStart(2, '0') // Months are zero-indexed
const day = String(date.getDate()).padStart(2, '0')
const hours = String(date.getHours()).padStart(2, '0')
const minutes = String(date.getMinutes()).padStart(2, '0')
const seconds = String(date.getSeconds()).padStart(2, '0')

// Construct adn return the ISO 8601 string
return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}${offsetSign}${offsetHours}:${offsetMinutes}`
return `${dateStr}T23:59:59+00:00`
}

0 comments on commit ab49e52

Please sign in to comment.