## Description The Changes in this PR includes, - separated the logic for getting Readable snapshot details and are derived on component render rather than on change of state to have upto date value on the conversion modal - Separated the DayJs Utils for the same. - Upon restoring Snapshot, change the layout type based on the response from API rather than the opposite of current layout type - Updated the width of modal widget for calculating the positions of children in PositionUtils - Updated Conversion algorithm to remove the dynamic binding path from list for property paths with default autolayout values Fixes #21967 Fixes #21969 Fixes #22244 Fixes #22094 Fixes #22187 Fixes #22697 # Type of change - Bug fix (non-breaking change which fixes an issue) ## How Has This Been Tested? Manual - Manual ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) ## Checklist: ### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag ### QA activity: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test --------- Co-authored-by: Preet <preetsidhu.bits@gmail.com>
33 lines
881 B
TypeScript
33 lines
881 B
TypeScript
import dayjs from "dayjs";
|
|
import duration from "dayjs/plugin/duration";
|
|
import relativeTime from "dayjs/plugin/relativeTime";
|
|
import advancedFormat from "dayjs/plugin/advancedFormat";
|
|
|
|
//add formatting plugins
|
|
dayjs.extend(duration);
|
|
dayjs.extend(relativeTime);
|
|
dayjs.extend(advancedFormat);
|
|
|
|
/**
|
|
* Gets humanized values of the time that has passed since like,
|
|
* a few seconds ago, an hour ago, 2 days ago etc
|
|
* @param timeInMilliseconds
|
|
* @returns humanized string
|
|
*/
|
|
export function getHumanizedTime(timeInMilliseconds: number): string {
|
|
return dayjs.duration(timeInMilliseconds, "milliseconds").humanize();
|
|
}
|
|
|
|
/**
|
|
* Gets readable date in the given format
|
|
* @param date
|
|
* @param formatString
|
|
* @returns readable date in format
|
|
*/
|
|
export function getReadableDateInFormat(
|
|
date: Date,
|
|
formatString: string,
|
|
): string {
|
|
return dayjs(date).format(formatString);
|
|
}
|