Mike Phares b771761936 Add option directory
Allow lower case drive letters
2025-02-11 14:23:11 -07:00

62 lines
2.6 KiB
JavaScript

"use strict";
// DateTime normal = DateTime.Now.ToUniversalTime();
// logger.LogInformation("Now - ToUniversalTime: {ticks}", normal.Ticks);
// DateTime utc1970DateTime = new(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
// logger.LogInformation("utc1970DateTime: {ticks}", utc1970DateTime.Ticks);
// logger.LogInformation("Subtract: {ticks}", DateTime.Now.Subtract(utc1970DateTime).Ticks);
// var epoch = new Date('1970-01-01T00:00:01');
// console.log("epoch: " + epoch.valueOf());
// var date = new Date();
// var timezoneOffset = date.getTimezoneOffset();
// console.log("timezoneOffset: " + timezoneOffset);
// var secondsAfter = (date.getTime().valueOf() + timezoneOffset) * 10000;
// var ticks = secondsAfter + 621355968000000000;
// console.log("ticks: " + ticks);
// var dateText = ticks + " - " + date.toString();
// console.log("dateText: " + dateText);
// DateTime utcMeDateTime = new(1980, 1, 17, 0, 0, 0, DateTimeKind.Utc);
// long meTotalSeconds = (long)Math.Floor(fileInfo.LastWriteTime.ToUniversalTime().Subtract(utcMeDateTime).TotalSeconds);
const now = new Date();
const time = now.getTime();
const year = now.getFullYear();
const start = new Date(year, 0, 0);
const oneDay = 1000 * 60 * 60 * 24;
const timezoneOffset = now.getTimezoneOffset();
const diff = (now - start) + ((start.getTimezoneOffset() - timezoneOffset) * 60 * 1000);
const day = Math.floor(diff / oneDay);
console.log('Day of year: ' + day);
var season = year + "-";
if (day < 78)
season = season + "0.Winter";
else if (day < 124)
season = season + "1.Spring";
else if (day < 171)
season = season + "2.Spring";
else if (day < 217)
season = season + "3.Summer";
else if (day < 264)
season = season + "4.Summer";
else if (day < 309)
season = season + "5.Fall";
else if (day < 354)
season = season + "6.Fall";
else
season = season + "7.Winter";
let seconds = time.valueOf() + timezoneOffset;
let epoch = seconds * 10000;
let ticks = epoch + 621355968000000000;
let dateText = seconds + " - " + ticks + " - " + now.toString();
console.log("dateText: " + dateText);
console.log("end");
let original = "d:\\5-Other-Small\\Kanban\\Year-Season\\2025\\2025-0.Winter\\1737913505637";
let segments = original.split('\\');
let path = segments.slice(0, -3).join('\\') + '\\2021\\2021-0.Summer\\123';
console.log(path);
// epoch: 25201000
// ticks: 638665132483790000
// dateText: 638665132483790000 - Wed Nov 06 2024 10:55:58 GMT-0700 (Mountain Standard Time)
// Now - To: 638665132334594771
// 638665135325760000
// 638665136814890000
// utc1970DateTime: 621355968000000000