Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import dayjs from "dayjs"
import utc from "dayjs/plugin/utc"
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
import type { TaskSelect } from "~/server/db/schema"
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc.js'
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
import type { TaskSelect } from '~/server/db/schema'

dayjs.extend(utc)

export function formatDate(date: string) {
return dayjs.utc(date).local().format("MMM D, YYYY hh:mm A")
return dayjs.utc(date).local().format('MMM D, YYYY hh:mm A')
}

export function cn(...inputs: ClassValue[]) {
Expand All @@ -16,7 +16,7 @@ export function cn(...inputs: ClassValue[]) {

export function limitText(text: string, length: number) {
if (text.length > length) {
return text.slice(0, length).trim() + "..."
return text.slice(0, length).trim() + '...'
}
return text
}
Expand All @@ -25,14 +25,14 @@ export function formatReturnValue(task: TaskSelect) {
if (task.returnValue?.return_value) {
return task.returnValue.return_value
} else {
return "null"
return 'null'
}
}

// temporarily, while dishka hasn't fixed it's module naming bug
export function formatTaskName(taskName: string) {
if (taskName.includes(":")) {
const parts = taskName.split(":")
if (taskName.includes(':')) {
const parts = taskName.split(':')
return parts[parts.length - 1]
} else {
return taskName
Expand Down
2 changes: 1 addition & 1 deletion src/server/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import utc from 'dayjs/plugin/utc.js'
import { NotFoundError } from './exceptions'

dayjs.extend(utc)
Expand Down