Skip to content

Commit 3b25aa6

Browse files
committed
feat: better default project names
1 parent 928dfd0 commit 3b25aa6

File tree

1 file changed

+6
-7
lines changed
  • taxonomy-editor-frontend/src/pages/startproject

1 file changed

+6
-7
lines changed

taxonomy-editor-frontend/src/pages/startproject/index.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,14 @@ import { createBaseURL, toSnakeCase } from "@/utils";
2222

2323
const branchNameRegEx = /[^a-z0-9_]+/;
2424

25-
function formatDate(date) {
26-
const map = {
25+
function dateComponents(date) {
26+
return {
2727
mm: ("0" + (date.getMonth() + 1)).slice(-2),
2828
dd: ("0" + date.getDate()).slice(-2),
29-
yy: ("0" + date.getFullYear()).slice(-2),
29+
yy: ("000" + date.getFullYear()).slice(-4),
3030
HH: ("0" + date.getHours()).slice(-2),
3131
MinMin: ("0" + date.getMinutes()).slice(-2),
3232
};
33-
34-
return `${map.mm}${map.dd}${map.yy}_${map.HH}_${map.MinMin}`;
3533
}
3634

3735
export const StartProject = () => {
@@ -44,7 +42,8 @@ export const StartProject = () => {
4442

4543
const findDefaultBranchName = useCallback(() => {
4644
if (taxonomyName === "" || ownerName === "") return "";
47-
return `${formatDate(new Date())}_${taxonomyName}_${ownerName}`
45+
const date = dateComponents(new Date());
46+
return `${date.yy}_${date.mm}_${date.dd}_${ownerName}_${taxonomyName}`
4847
.replace(/[\s-]+/g, "_")
4948
.toLowerCase();
5049
}, [ownerName, taxonomyName]);
@@ -191,7 +190,7 @@ export const StartProject = () => {
191190
>
192191
Explain what is your goal with this new project, what changes are
193192
you going to bring. Remember to privilege small projects (do big
194-
project as a succession of small one).
193+
project as a succession of small ones).
195194
</FormHelperText>
196195

197196
<Button

0 commit comments

Comments
 (0)