mirror of
https://github.com/frappe/books.git
synced 2024-11-10 07:40:55 +00:00
fix: Better date format options with label
This commit is contained in:
parent
a53cc9f119
commit
7071879ae5
@ -1,3 +1,26 @@
|
||||
const { DateTime } = require('luxon');
|
||||
|
||||
let dateFormatOptions = (() => {
|
||||
let formats = [
|
||||
'dd/MM/yyyy',
|
||||
'MM/dd/yyyy',
|
||||
'dd-MM-yyyy',
|
||||
'MM-dd-yyyy',
|
||||
'yyyy-MM-dd',
|
||||
'd MMM, y',
|
||||
'MMM d, y'
|
||||
];
|
||||
|
||||
let today = DateTime.local();
|
||||
|
||||
return formats.map(format => {
|
||||
return {
|
||||
label: today.toFormat(format),
|
||||
value: format
|
||||
};
|
||||
});
|
||||
})();
|
||||
|
||||
module.exports = {
|
||||
name: 'SystemSettings',
|
||||
label: 'System Settings',
|
||||
@ -10,15 +33,7 @@ module.exports = {
|
||||
fieldname: 'dateFormat',
|
||||
label: 'Date Format',
|
||||
fieldtype: 'Select',
|
||||
options: [
|
||||
'dd/MM/yyyy',
|
||||
'MM/dd/yyyy',
|
||||
'dd-MM-yyyy',
|
||||
'MM-dd-yyyy',
|
||||
'yyyy-MM-dd',
|
||||
'd MMM, y',
|
||||
'MMM d, y'
|
||||
],
|
||||
options: dateFormatOptions,
|
||||
default: 'MMM d, y',
|
||||
required: 1
|
||||
},
|
||||
@ -29,6 +44,6 @@ module.exports = {
|
||||
options: ['2', '3', '4', '5'],
|
||||
default: '2',
|
||||
required: 1
|
||||
},
|
||||
}
|
||||
]
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user