fix: parse date using date picker and add password strength validation, etc (#8647)

* fix: date parse by picker

* fix: password
This commit is contained in:
Jiann
2026-02-14 11:48:42 +08:00
committed by GitHub
parent cab542436f
commit eb10d25e32
3 changed files with 16 additions and 8 deletions
@@ -28,11 +28,11 @@ export const DateTimeNoTzPicker = (props) => {
return onChange(val);
}
const outputFormat = showTime ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
if (showTime) {
onChange(dayjs(val, format).format(outputFormat));
} else {
onChange(dayjs(val, format).startOf(picker).format(outputFormat));
}
// Adjust to start of period for month/quarter/year pickers
const adjustedVal = picker !== 'date' ? dayjs(val).startOf(picker) : dayjs(val);
onChange(adjustedVal.format(outputFormat));
},
};
@@ -56,7 +56,15 @@ export const DateTimeTzPicker = (props) => {
picker,
showTime,
onChange: (val: any) => {
const result = parseToDate(val, format);
let result = parseToDate(val, format);
// Adjust to start of period for month/quarter/year pickers
if (result && picker !== 'date') {
const date = dayjs(result);
if (date.isValid()) {
result = date.startOf(picker).toDate();
}
}
rest.onChange(result);
},
};
@@ -7,14 +7,14 @@
* For more information, please refer to: https://www.nocobase.com/agreement.
*/
import { Input } from 'antd';
import React from 'react';
import { EditableItemModel, tExpr } from '@nocobase/flow-engine';
import { Password } from '../../../schema-component/antd/password';
import { FieldModel } from '../base';
export class PasswordFieldModel extends FieldModel {
render() {
return <Input.Password {...this.props} />;
return <Password {...this.props} />;
}
}