Skip to content

Commit

Permalink
Merge branch 'master' into fix/timestamp-form
Browse files Browse the repository at this point in the history
  • Loading branch information
Yehor Podporinov authored and Yehor Podporinov committed Sep 17, 2023
2 parents 6439549 + 7550b4b commit 3820d8a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions forms/DateForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
<datetime-field
:model-value="datetimeFieldTimestamp"
@update:model-value="setForm($event)"
@update:model-value="setForm(new Time($event))"
/>
</div>
<div class="date-form__output">
Expand All @@ -40,7 +40,7 @@ import { AppCopy } from '#components'
import { useFormValidation } from '@/composables'
import { DatetimeField, InputField } from '@/fields'
import { integer, maxValue, minValue, required } from '@/helpers'
import { Time, type TimeDate } from '@distributedlab/tools'
import { Time } from '@distributedlab/tools'
import { computed, reactive } from 'vue'
import { i18n } from '~/plugins/localization'
Expand Down Expand Up @@ -105,8 +105,7 @@ const { getFieldErrorMessage, isFormValid, touchField } = useFormValidation(
rules,
)
const setForm = (date?: TimeDate) => {
const time = new Time(date)
const setForm = (time: Time) => {
form.year = String(time.get('year'))
form.month = String(time.get('month') + 1)
form.day = String(time.get('date'))
Expand All @@ -115,7 +114,7 @@ const setForm = (date?: TimeDate) => {
form.second = String(time.get('second'))
}
setForm()
setForm(new Time().utc())
const localTime = computed<Time | null>(() => {
if (!isFormValid()) return null
Expand Down

0 comments on commit 3820d8a

Please sign in to comment.