New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rschedule/moment-tz-date-adapter

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rschedule/moment-tz-date-adapter - npm Package Versions

134

0.12.1

Diff

Changelog

Source

0.12.1 FIX (2019/9/26)

Fixes

  • Fixed module build targets so that UMD targets es5 and es2015 targets es2015 (#34)
jcarroll
published 0.12.0 •

Changelog

Source

0.12.0 BREAKING (2019/9/15)

This is a large breaking change to the library that simplifies the API and increases the modularity / extensibility of the code. You should check out the updated docs to understand all of the changes. The new API is similar to the old API, but better.

API improvements

Through some dark, typescript sorcery, rSchedule no longer needs to export generic objects to adapt the library's typing for different date adapters. Now you can simply import your date adapter of choice once, and the types of rSchedule's objects will automatically be updated. Where before you might have:

const rule = new Rule<typeof MomentDateAdapter>();

const dates: Moment[] = rule
  .occurrences()
  .toArray()
  .map(({ date }) => date);

// OR

const rule = new Rule<typeof StandardDateAdapter>();

const dates: Date[] = rule
  .occurrences()
  .toArray()
  .map(({ date }) => date);

now you simply have

const rule = new Rule();

const dates: Moment[] = rule
  .occurrences()
  .toArray()
  .map(({ date }) => date);

// OR, when using the StandardDateAdapter

const rule = new Rule();

const dates: Date[] = rule
  .occurrences()
  .toArray()
  .map(({ date }) => date);

it's magical! End users need never touch a date adapter.

Modularity changes

The @rschedule/rschedule package has been removed and replaced with @rschedule/core which itself has been broken up into @rschedule/core, @rschedule/core/generators, and @rschedule/core/rules. The recurrence rule API has also been improved, simplified, and now made public (where before it was private API).

  • @rschedule/core contains the required bits of the library: the recurrence and date adapter logic and nothing else (it doesn't contain any actual recurrence rules).
  • @rschedule/core/rules contains individual rule modules. You can now pick and choose which rules you care about, potentially reducing bundle size. Unused rules are tree-shakable. This also means that this library can add additional rules in the future, without worrying about bloating the library for folks that don't need the new features.
  • Similarly, @rschedule/core/generators contains the opinionated OccurrenceGenerator API, which is also now optional and tree-shakable. This allows additional occurrence stream operators to be added in the future, without fear of bloating the library for folks who don't need them.

Breaking

Note: this update is large and not all changes are included below.

  • @rschedule/rschedule -> @rschedule/core, @rschedule/core/generators, and @rschedule/core/rules.
  • DateAdapter updated to support different date libraries via typescript declaration merging. This affects almost all of the types in the library, most of which are no longer generic.
    • OccurrenceGenerator is no longer generic. Similarly, Calendar, Schedule, Rule, and Dates only receive an optional generic param for their data attribute.
    • IDateAdapter removed and folded into the DateAdapterBase class. Now, all date adapters must extend the abstract DateAdapterBase class.
    • DateAdapter class renamed DateAdapterBase. DateAdapter is now an exported type equal to the activated date adapter, as well as a namespace.
    • It is now impossible to utilize two different date adapters in a single project at the same time. This was never encouraged, but previously it was possible.
  • Dates duration constructor argument now only applies the duration to provided dates which do not already have a duration. Put another way, the duration option for the dates constructor now acts as a default duration for provided dates, rather than the duration of all dates.
  • DateAdapter#duration type changed from number | undefined to number. A duration of 0 is treated as no duration.
  • OccurrenceGenerator#collections() arguments changed. Specifically, CollectionIterator ICollectionArgs interface changed.
    • incrementLinearly option removed
    • skipEmptyPeriods option added
    • granularity "INSTANTANIOUS" option removed. Use "MILLISECONDLY" instead (which does the same thing).
    • By default, OccurrenceGenerator#collections() now increments linearly. You can use skipEmptyPeriods: true to get the old default behavior.
  • Default granularity for OccurrenceGenerator#collections() is now "YEARLY". This change was made to accomidate the other changes to CollectionIterator.
  • @rschedule/json-tools no longer exports parseJSON() or serializeToJSON() functions. Instead, the library contains individual modules for each rSchedule object which, when imported, modify that rschedule object, adding toJSON() and static fromJSON() methods.
  • @rschedule/ical-tools no longer exports parseICal() or serializeToICal() functions. Instead, VEvent now has VEvent#toICal() and VEvent.fromICal().

Features

  • Added DateAdapter#set('duration', number) option for setting a date adapters duration.
  • RecurrenceRuleIterator, as well as individual recurrence rules, are now public API.

Fixes

  • Fixed potential bug when calling OccurrenceGenerator#collections() with granularity "MONTHLY" and a weekStart value.
  • Fixed the return type of OccurrenceGenerator#[Symbol.iterator]

Peformance

  • OccurrenceGenerator#firstDate and OccurrenceGenerator#lastDate now cache their value after the initial lazy evaluation.
  • Combine time-related rule pipe logic into a base class to reduce bundle size

Releases

jcarroll
published 0.11.7-next.14 •

jcarroll
published 0.11.7-next.12 •

jcarroll
published 0.11.7-next.27 •

jcarroll
published 0.11.7-next.26 •

jcarroll
published 0.11.7-next.23 •

jcarroll
published 0.11.6 •

Changelog

Source

0.11.6 FEATURE (2019/8/18)

Features

  • Rigorously assert that rule options are valid. Previously, the library assumed typescript would catch obvious type errors and wouldn't bother checking for them.
  • Add JodaDateAdapter

Fixes

  • Prevent VEvent objects from being initialized with a rule specifying a MILLISECONDLY frequency.
jcarroll
published 0.11.0 •

Changelog

Source

0.11.0 BREAKING (2019/5/4)

Breaking

  • updated RScheduleConfig so that config options are namespaced.
  • updated @rschedule/json-tools
    • So that IntersectionOperator#maxFailedIterations is serialized.
      • There is no longer the option to provide maxFailedIterations to parseJSON().
    • The serializeToJSON() interface has changed
    • The parseJSON() interface has changed to improve typing
  • replace ConstructorReturnType with typescript builtin InstanceType
  • reversed the order of the DateAdapter#generators property.
  • changed the default type of DateAdapter#generators to unknown[]
  • fixed type inference in some @rschedule/rule-tools methods which involved changing the type arguments.

Features

  • added @rschedule/rule-tools package.
  • ability to set all Rule#options via Rule#set().
  • added IScheduleLike<T extends typeof DateAdapter> interface.
  • added IDataContainer<D> interface
  • added RScheduleConfig.Rule.defaultWeekStart config option.
  • added Operator.isOperator()
  • added support for serializing / parsing the data property to @rschedule/json-tools.
  • when iterating through a Schedule, Calendar, VEvent, Dates, or Rule object, the generators property now receives some proper typing. This will make accessing the data property on occurrence generators easier.
  • improved typing of many isInstance methods.
  • added DateAdapterFor<O extends IOccurrenceGenerator>
  • added DataFor<O extends IDataContainer>
  • added DateAdapter#end
  • ability to keep local time when calling IOccurrenceGenerator#set('timezone')

Fixes

  • AddOperator.isAddOperator()
  • SubtractOperator.isSubtractOperator()
  • IntersectionOperator.isIntersectionOperator()
  • UniqueOperator.isUniqueOperator()
  • OccurrenceStream.isOccurrenceStream()
  • ensure DateAdapter#date is immutable
  • don't include undefined properties in DateAdapter#toJSON()
  • ensure DateAdapter#generators is propogated to results
jcarroll
published 0.11.0-next.10 •

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc