mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
update : convly request applied
This commit is contained in:
parent
11923a820f
commit
83ca415e9d
@ -14,6 +14,13 @@ const validateInput = (input) => {
|
||||
return regex.test(input) || "Please use only letters and number, '-' or '_' and no spaces";
|
||||
};
|
||||
|
||||
const getFormattedDate = (date = new Date()) => {
|
||||
return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
|
||||
.toISOString()
|
||||
.split(".")[0]
|
||||
.replace(/[-T:]/g, "_");
|
||||
};
|
||||
|
||||
module.exports = (plop) => {
|
||||
// Migration generator
|
||||
plop.setGenerator('migration', {
|
||||
@ -29,7 +36,7 @@ module.exports = (plop) => {
|
||||
actions(answers) {
|
||||
const currentDir = process.cwd();
|
||||
const language = tsUtils.isUsingTypeScriptSync(currentDir) ? 'ts' : 'js';
|
||||
const timestamp = moment().format('YYYY_MM_DD_HH_mm_ss');
|
||||
const timestamp = getFormattedDate();
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Knex } from 'knex';
|
||||
import type { Knex } from 'knex';
|
||||
|
||||
/**
|
||||
* Migration `{{ id }}`
|
||||
|
||||
@ -36,8 +36,7 @@
|
||||
"fs-extra": "10.0.0",
|
||||
"node-plop": "0.26.3",
|
||||
"plop": "2.7.6",
|
||||
"pluralize": "8.0.0",
|
||||
"moment": "^2.29.4"
|
||||
"pluralize": "8.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.19.1 <=18.x.x",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user