@northlight/ui 2.24.4 → 2.24.5

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.
@@ -6895,15 +6895,16 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6895
6895
  },
6896
6896
  label: "Next Year"
6897
6897
  };
6898
+ const offsetFiscalYear = thisDay.month < fiscalStartMonth || thisDay.month === fiscalStartMonth && thisDay.day < fiscalStartDay ? 1 : 0;
6898
6899
  const thisFiscalYear = {
6899
6900
  value: {
6900
6901
  start: startOfMonthWithDays(
6901
- startOfYear(thisDay),
6902
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6902
6903
  { months: fiscalStartMonth, days: fiscalStartDay }
6903
6904
  ),
6904
6905
  end: endOfMonthWithDays(
6905
- startOfYear(thisDay),
6906
- { months: fiscalStartMonth + 11, days: fiscalStartDay }
6906
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6907
+ { months: fiscalStartMonth + 12, days: fiscalStartDay }
6907
6908
  )
6908
6909
  },
6909
6910
  label: "This Fiscal Year"
@@ -6911,22 +6912,28 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6911
6912
  const lastFiscalYear = {
6912
6913
  value: {
6913
6914
  start: startOfMonthWithDays(
6914
- startOfYear(thisDay).subtract({ years: 1 }),
6915
- { months: fiscalStartMonth, days: fiscalStartDay - 1 }
6915
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
6916
+ {
6917
+ months: fiscalStartMonth,
6918
+ days: fiscalStartDay
6919
+ }
6916
6920
  ),
6917
6921
  end: endOfMonthWithDays(
6918
- startOfYear(thisDay).subtract({ years: 1 }),
6919
- { months: fiscalStartMonth + 11, days: fiscalStartDay }
6922
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear + 1 }),
6923
+ {
6924
+ months: fiscalStartMonth + 12,
6925
+ days: fiscalStartDay
6926
+ }
6920
6927
  )
6921
6928
  },
6922
6929
  label: "Last Fiscal Year"
6923
6930
  };
6924
6931
  const yearToDate = {
6925
6932
  value: {
6926
- start: startOfMonthWithDays(
6927
- startOfYear(thisDay),
6928
- { months: fiscalStartMonth, days: fiscalStartDay }
6929
- ),
6933
+ start: startOfMonthWithDays(startOfYear(thisDay), {
6934
+ months: fiscalStartMonth,
6935
+ days: fiscalStartDay
6936
+ }),
6930
6937
  end: thisDay
6931
6938
  },
6932
6939
  label: "Year to Date"
@@ -6934,12 +6941,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6934
6941
  const F1 = {
6935
6942
  value: {
6936
6943
  start: startOfMonthWithDays(
6937
- startOfYear(thisDay),
6938
- { months: fiscalStartMonth, days: fiscalStartDay }
6944
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6945
+ {
6946
+ months: fiscalStartMonth,
6947
+ days: fiscalStartDay
6948
+ }
6939
6949
  ),
6940
6950
  end: endOfMonthWithDays(
6941
- startOfYear(thisDay),
6942
- { months: fiscalStartMonth + 3, days: fiscalStartDay }
6951
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6952
+ {
6953
+ months: fiscalStartMonth + 3,
6954
+ days: fiscalStartDay
6955
+ }
6943
6956
  )
6944
6957
  },
6945
6958
  label: fiscalStartMonth === 0 ? "Q1" : "FQ1"
@@ -6947,12 +6960,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6947
6960
  const F2 = {
6948
6961
  value: {
6949
6962
  start: startOfMonthWithDays(
6950
- startOfYear(thisDay),
6951
- { months: fiscalStartMonth + 3, days: fiscalStartDay }
6963
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6964
+ {
6965
+ months: fiscalStartMonth + 3,
6966
+ days: fiscalStartDay
6967
+ }
6952
6968
  ),
6953
6969
  end: endOfMonthWithDays(
6954
- startOfYear(thisDay),
6955
- { months: fiscalStartMonth + 6, days: fiscalStartDay }
6970
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6971
+ {
6972
+ months: fiscalStartMonth + 6,
6973
+ days: fiscalStartDay
6974
+ }
6956
6975
  )
6957
6976
  },
6958
6977
  label: fiscalStartMonth === 0 ? "Q2" : "FQ2"
@@ -6960,12 +6979,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6960
6979
  const F3 = {
6961
6980
  value: {
6962
6981
  start: startOfMonthWithDays(
6963
- startOfYear(thisDay),
6964
- { months: fiscalStartMonth + 6, days: fiscalStartDay }
6982
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6983
+ {
6984
+ months: fiscalStartMonth + 6,
6985
+ days: fiscalStartDay
6986
+ }
6965
6987
  ),
6966
6988
  end: endOfMonthWithDays(
6967
- startOfYear(thisDay),
6968
- { months: fiscalStartMonth + 9, days: fiscalStartDay }
6989
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
6990
+ {
6991
+ months: fiscalStartMonth + 9,
6992
+ days: fiscalStartDay
6993
+ }
6969
6994
  )
6970
6995
  },
6971
6996
  label: fiscalStartMonth === 0 ? "Q3" : "FQ3"
@@ -6973,12 +6998,18 @@ const getQuickSelectOptions = (state, locale, fiscalStartMonth, fiscalStartDay)
6973
6998
  const F4 = {
6974
6999
  value: {
6975
7000
  start: startOfMonthWithDays(
6976
- startOfYear(thisDay),
6977
- { months: fiscalStartMonth + 9, days: fiscalStartDay }
7001
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
7002
+ {
7003
+ months: fiscalStartMonth + 9,
7004
+ days: fiscalStartDay
7005
+ }
6978
7006
  ),
6979
7007
  end: endOfMonthWithDays(
6980
- startOfYear(thisDay),
6981
- { months: fiscalStartMonth + 12, days: fiscalStartDay }
7008
+ startOfYear(thisDay).subtract({ years: offsetFiscalYear }),
7009
+ {
7010
+ months: fiscalStartMonth + 12,
7011
+ days: fiscalStartDay
7012
+ }
6982
7013
  )
6983
7014
  },
6984
7015
  label: fiscalStartMonth === 0 ? "Q4" : "FQ4"