@full-ui/headless-calendar 7.0.0-beta.7 → 7.0.0-beta.8

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/index.js +7 -6
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,4 +1,6 @@
1
- import { Temporal } from 'temporal-polyfill';
1
+ import * as ZonedDateTimeFns from 'temporal-polyfill/fns/zoneddatetime';
2
+ import * as PlainDateTimeFns from 'temporal-polyfill/fns/plaindatetime';
3
+ import * as InstantFns from 'temporal-polyfill/fns/instant';
2
4
 
3
5
  // Adding
4
6
  function addWeeks(m, n) {
@@ -831,10 +833,9 @@ class DateEnv {
831
833
  if (this.timeZone === 'UTC') {
832
834
  return new Date(ms);
833
835
  }
834
- const zdt = Temporal.Instant.fromEpochMilliseconds(ms)
835
- .toZonedDateTimeISO(this.timeZone);
836
+ const zdtFields = ZonedDateTimeFns.getFields(InstantFns.toZonedDateTimeISO(InstantFns.fromEpochMilliseconds(ms), this.timeZone));
836
837
  return new Date(// a "Date Marker", which is like PlainDateTime
837
- Date.UTC(zdt.year, zdt.month - 1, zdt.day, zdt.hour, zdt.minute, zdt.second, zdt.millisecond));
838
+ Date.UTC(zdtFields.year, zdtFields.month - 1, zdtFields.day, zdtFields.hour, zdtFields.minute, zdtFields.second, zdtFields.millisecond));
838
839
  }
839
840
  offsetForMarker(m) {
840
841
  if (this.timeZone === 'local') {
@@ -843,7 +844,7 @@ class DateEnv {
843
844
  if (this.timeZone === 'UTC') {
844
845
  return 0;
845
846
  }
846
- return new Temporal.PlainDateTime(m.getUTCFullYear(), m.getUTCMonth() + 1, m.getUTCDate(), m.getUTCHours(), m.getUTCMinutes(), m.getUTCSeconds(), m.getUTCMilliseconds()).toZonedDateTime(this.timeZone).offsetNanoseconds / (1000000000 * 60);
847
+ return ZonedDateTimeFns.offsetNanoseconds(PlainDateTimeFns.toZonedDateTime(PlainDateTimeFns.create(m.getUTCFullYear(), m.getUTCMonth() + 1, m.getUTCDate(), m.getUTCHours(), m.getUTCMinutes(), m.getUTCSeconds(), m.getUTCMilliseconds()), this.timeZone)) / (1000000000 * 60);
847
848
  }
848
849
  // Conversion
849
850
  toDate(m) {
@@ -853,7 +854,7 @@ class DateEnv {
853
854
  if (this.timeZone === 'UTC') {
854
855
  return new Date(m.valueOf()); // make sure it's a copy
855
856
  }
856
- return new Date(new Temporal.PlainDateTime(m.getUTCFullYear(), m.getUTCMonth() + 1, m.getUTCDate(), m.getUTCHours(), m.getUTCMinutes(), m.getUTCSeconds(), m.getUTCMilliseconds()).toZonedDateTime(this.timeZone).epochMilliseconds);
857
+ return new Date(ZonedDateTimeFns.epochMilliseconds(PlainDateTimeFns.toZonedDateTime(PlainDateTimeFns.create(m.getUTCFullYear(), m.getUTCMonth() + 1, m.getUTCDate(), m.getUTCHours(), m.getUTCMinutes(), m.getUTCSeconds(), m.getUTCMilliseconds()), this.timeZone)));
857
858
  }
858
859
  }
859
860
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@full-ui/headless-calendar",
3
- "version": "7.0.0-beta.7",
3
+ "version": "7.0.0-beta.8",
4
4
  "keywords": [
5
5
  "headless",
6
6
  "calendar",
@@ -9,7 +9,7 @@
9
9
  "title": "Headless Calendar Library",
10
10
  "description": "Headless calendar library by the makers of FullCalendar",
11
11
  "peerDependencies": {
12
- "temporal-polyfill": "^0.3.0"
12
+ "temporal-polyfill": "^0.3.2"
13
13
  },
14
14
  "type": "module",
15
15
  "homepage": "https://fullcalendar.io",