Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

740 B
Raw Blame
import * as React from 'react'

function usePickerNumbers(locale: Intl.LocalesArgument = 'en-US') {
  return React.useMemo(() => {
    const integer = new Intl.NumberFormat(locale, { useGrouping: false })
    const minute = new Intl.NumberFormat(locale, { useGrouping: false, minimumIntegerDigits: 2 })
    const digits = new Map(
      Array.from({ length: 10 }, (_, digit) => [integer.format(digit), String(digit)]),
    )
    return {
      numberingSystem: integer.resolvedOptions().numberingSystem,
      formatInteger: integer.format,
      formatMinute: minute.format,
      normalizeDigits: (text: string) =>
        Array.from(text, (char) => digits.get(char) ?? char).join(''),
    }
  }, [locale])
}

export { usePickerNumbers }