mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
Saved files’ filename now holds local time (#505)
Correcting PR #504, which made saved files’ filenames follow the UTC. This commit modifies the way the filename is generated and makes it follow the user’s local time.
This commit is contained in:
parent
0907adc039
commit
a610a70e1c
1 changed files with 10 additions and 1 deletions
|
|
@ -544,9 +544,18 @@ function unfog(id) {
|
|||
}
|
||||
|
||||
function getFileName(dataType) {
|
||||
const formatTime = (time) => {
|
||||
return (time < 10) ? "0" + time : time;
|
||||
};
|
||||
const name = mapName.value;
|
||||
const type = dataType ? dataType + " " : "";
|
||||
const dateString = new Date().toISOString().replace(/:[0-9]+\..*/, "").replace(/[T:]/g, "-");
|
||||
const date = new Date();
|
||||
const year = date.getFullYear();
|
||||
const month = formatTime(date.getMonth());
|
||||
const day = formatTime(date.getDay());
|
||||
const hour = formatTime(date.getHours());
|
||||
const minutes = formatTime(date.getMinutes());
|
||||
const dateString = [year, month, day, hour, minutes].join('-');
|
||||
return name + " " + type + dateString;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue