-
-
Save hiloki/c1baa49e4d3f2020d03ec910df287329 to your computer and use it in GitHub Desktop.
Figma Plugin script: Clone page for backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Clone current page | |
const clonePage = figma.currentPage.clone(); | |
// Get current date | |
const currentDate = new Date(); | |
// Concat page name with current date | |
clonePage.name = `${clonePage.name} [${getCurrentTime(currentDate)}]`; | |
function getCurrentTime(currentDate) { | |
const year = currentDate.getFullYear(); | |
const month = (currentDate.getMonth() + 1).toString().padStart(2, '0'); | |
const date = currentDate.getDate().toString().padStart(2, '0'); | |
const hours = currentDate.getHours().toString().padStart(2, '0'); | |
const minutes = currentDate.getMinutes().toString().padStart(2, '0'); | |
return `${year}/${month}/${date} ${hours}:${minutes}`; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment