[fix] Incorrect formatted date
- #61 - problem: December being formatted as 01ecember
This commit is contained in:
parent
8f4214a926
commit
cd93fbf655
@ -81,13 +81,21 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let str = format_string;
|
let str = format_string;
|
||||||
|
const formatted_values = [];
|
||||||
|
|
||||||
Object.keys(format_map)
|
Object.keys(format_map)
|
||||||
.sort((a, b) => b.length - a.length) // big string first
|
.sort((a, b) => b.length - a.length) // big string first
|
||||||
.forEach(key => {
|
.forEach(key => {
|
||||||
str = str.replace(key, format_map[key]);
|
if (str.includes(key)) {
|
||||||
|
str = str.replace(key, `$${formatted_values.length}`);
|
||||||
|
formatted_values.push(format_map[key]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
formatted_values.forEach((value, i) => {
|
||||||
|
str = str.replace(`$${i}`, value);
|
||||||
|
});
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user