forked from cerc-io/snowballtools-base
* Create new deployment when changing to production * Remove unnecessary todos * Move deployment id and url creation in database method * Display correct details in deployment dialog box * Rename relativeTime function to relativeTimeISO * Refactor resolver methods to service class * Refactor to move github app to service class --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
22 lines
731 B
TypeScript
22 lines
731 B
TypeScript
import { DateTime } from 'luxon';
|
|
|
|
/**
|
|
* Converts an ISO 8601 formatted time to a human-readable relative time with respect to the current time.
|
|
*
|
|
* @param {string} time - The input time in ISO 8601 format.
|
|
* @returns {string} - A human-readable relative time string.
|
|
*/
|
|
export const relativeTimeISO = (time: string) => {
|
|
return DateTime.fromISO(time).toRelative();
|
|
};
|
|
|
|
/**
|
|
* Converts time in millisecond format to a human-readable relative time with respect to the current time.
|
|
*
|
|
* @param {string} time - The input time in millisecond.
|
|
* @returns {string} - A human-readable relative time string.
|
|
*/
|
|
export const relativeTimeMs = (time: string) => {
|
|
return relativeTimeISO(new Date(Number(time)).toISOString());
|
|
};
|