Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import { Lang } from '@scandic-hotels/common/constants/language'
|
||||
import type { RegisterOptions } from 'react-hook-form'
|
||||
import { Lang } from "@scandic-hotels/common/constants/language"
|
||||
import type { RegisterOptions } from "react-hook-form"
|
||||
|
||||
export const enum DateName {
|
||||
date = 'date',
|
||||
day = 'day',
|
||||
month = 'month',
|
||||
year = 'year',
|
||||
date = "date",
|
||||
day = "day",
|
||||
month = "month",
|
||||
year = "year",
|
||||
}
|
||||
export interface DateProps
|
||||
extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
||||
export interface DateProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
||||
labels: {
|
||||
day: string
|
||||
month: string
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
'use client'
|
||||
import { parseDate } from '@internationalized/date'
|
||||
import { useEffect } from 'react'
|
||||
import { useController, useFormContext, useWatch } from 'react-hook-form'
|
||||
import { useMediaQuery } from 'usehooks-ts'
|
||||
"use client"
|
||||
import { parseDate } from "@internationalized/date"
|
||||
import { useEffect } from "react"
|
||||
import { useController, useFormContext, useWatch } from "react-hook-form"
|
||||
import { useMediaQuery } from "usehooks-ts"
|
||||
|
||||
import { dt } from '@scandic-hotels/common/dt'
|
||||
import { logger } from '@scandic-hotels/common/logger'
|
||||
import { getLocalizedMonthName } from '@scandic-hotels/common/utils/dateFormatting'
|
||||
import { rangeArray } from '@scandic-hotels/common/utils/rangeArray'
|
||||
import { ErrorMessage } from '../../Form/ErrorMessage'
|
||||
import { Select } from '../../Select'
|
||||
import { dt } from "@scandic-hotels/common/dt"
|
||||
import { logger } from "@scandic-hotels/common/logger"
|
||||
import { getLocalizedMonthName } from "@scandic-hotels/common/utils/dateFormatting"
|
||||
import { rangeArray } from "@scandic-hotels/common/utils/rangeArray"
|
||||
import { ErrorMessage } from "../../Form/ErrorMessage"
|
||||
import { Select } from "../../Select"
|
||||
|
||||
import { DateName, type DateProps } from './date'
|
||||
import { DateName, type DateProps } from "./date"
|
||||
|
||||
import styles from './date.module.css'
|
||||
import styles from "./date.module.css"
|
||||
|
||||
export default function DateSelect({
|
||||
labels,
|
||||
@@ -21,7 +21,7 @@ export default function DateSelect({
|
||||
name,
|
||||
registerOptions = {},
|
||||
}: DateProps) {
|
||||
const isDesktop = useMediaQuery('(min-width: 768px)', {
|
||||
const isDesktop = useMediaQuery("(min-width: 768px)", {
|
||||
initializeWithValue: false,
|
||||
})
|
||||
|
||||
@@ -37,7 +37,7 @@ export default function DateSelect({
|
||||
const month = watch(DateName.month)
|
||||
const day = watch(DateName.day)
|
||||
|
||||
const minAgeDate = dt().subtract(18, 'year').toDate() // age 18
|
||||
const minAgeDate = dt().subtract(18, "year").toDate() // age 18
|
||||
const minAgeYear = minAgeDate.getFullYear()
|
||||
const minAgeMonth = year === minAgeYear ? minAgeDate.getMonth() + 1 : null
|
||||
const minAgeDay =
|
||||
@@ -86,7 +86,7 @@ export default function DateSelect({
|
||||
.date(Number(day))
|
||||
|
||||
if (newDate.isValid()) {
|
||||
setValue(name, newDate.format('YYYY-MM-DD'), {
|
||||
setValue(name, newDate.format("YYYY-MM-DD"), {
|
||||
shouldDirty: true,
|
||||
shouldTouch: true,
|
||||
shouldValidate: true,
|
||||
@@ -105,7 +105,7 @@ export default function DateSelect({
|
||||
? parseDate(currentDateValue)
|
||||
: null
|
||||
} catch (error) {
|
||||
logger.warn('Known error for parse date in DateSelect: ', error)
|
||||
logger.warn("Known error for parse date in DateSelect: ", error)
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user