@aiusage/cli 1.4.0 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +8 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -2760,6 +2760,8 @@ async function runSync(flags) {
2760
2760
  targetDates = [requestedDate];
2761
2761
  else if (fromDate)
2762
2762
  targetDates = buildDateRange(fromDate, toDate ?? getTodayDate());
2763
+ else if (flags.today === !0)
2764
+ targetDates = [getTodayDate()];
2763
2765
  else {
2764
2766
  let lookbackDays = typeof flags.lookback == "string" ? parsePositiveInt2(flags.lookback, "--lookback") : defaultLookbackDays(config);
2765
2767
  targetDates = getClosedDates(lookbackDays), targetDates.push(getTodayDate());
@@ -2961,12 +2963,15 @@ function parseArgs(args) {
2961
2963
  }
2962
2964
  return { flags, positionals };
2963
2965
  }
2966
+ function localDateKey(d) {
2967
+ return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
2968
+ }
2964
2969
  function getYesterdayDate() {
2965
2970
  let yesterday = /* @__PURE__ */ new Date();
2966
- return yesterday.setDate(yesterday.getDate() - 1), yesterday.toISOString().split("T")[0];
2971
+ return yesterday.setDate(yesterday.getDate() - 1), localDateKey(yesterday);
2967
2972
  }
2968
2973
  function getTodayDate() {
2969
- return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2974
+ return localDateKey(/* @__PURE__ */ new Date());
2970
2975
  }
2971
2976
  function buildDateRange(from, to) {
2972
2977
  let start = /* @__PURE__ */ new Date(from + "T00:00:00"), end = /* @__PURE__ */ new Date(to + "T00:00:00");
@@ -2984,7 +2989,7 @@ function getClosedDates(lookbackDays) {
2984
2989
  let dates = [];
2985
2990
  for (let offset = lookbackDays; offset >= 1; offset -= 1) {
2986
2991
  let day = /* @__PURE__ */ new Date();
2987
- day.setDate(day.getDate() - offset), dates.push(day.toISOString().split("T")[0]);
2992
+ day.setDate(day.getDate() - offset), dates.push(localDateKey(day));
2988
2993
  }
2989
2994
  return dates;
2990
2995
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiusage/cli",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "Track and sync AI tool token usage across devices.",
5
5
  "license": "MIT",
6
6
  "private": false,