mirror of
https://github.com/nocobase/nocobase.git
synced 2026-10-29 18:16:18 +08:00
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:
+5
-5
@@ -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));
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
+9
-1
@@ -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} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user