Skip to content

Releases: meduzen/datetime-attribute

1.4.0

21 Apr 21:54
Compare
Choose a tag to compare

New

  • Add setTzInRealWorldRange() allowing to shift timezones to be inside the real-world (IANA) range.
  • Add setTzConfig() to set the timezone related configuration: pass it an object to set the timezone separator and enforce the IANA range at the same time.

Improved

  • Improve multiple typing resolutions: previously, 1 .d.ts file were generated by .js file, preserving the initial folder structure. In both plain JavaScript and TypeScript environments, this was leading to quirks like:
    • types exported from subpath instead of root
    • unexported functions being exported as types

Despite these, documented functions were properly exposed but global typing discoverability was a mess. See the comment in the related pull requests for more. This is now fixed by cleaning and combining all .d.ts files into one thanks to dts-bundle-generator.

Documentation

  • Fix documentation examples for tzOffset.
  • Rephrase some parts.

Under the hood

  • And add more tests for tzOffset in order to strenghten. This will be useful for the work around the standardized Temporal API.
  • Update ESLint config to group import statements by source.
  • Change TypeScript target to ESNExt.
  • Rename some internals.
  • Remove test files from published package.

1.4.0-rc.0

21 Apr 21:41
Compare
Choose a tag to compare
1.4.0-rc.0 Pre-release
Pre-release

This is a test release to see how typing resolution is working when installing the package from a remote registry.

Changes: see 1.4.0.

1.3.4

18 Apr 21:53
b9ef414
Compare
Choose a tag to compare

Fixed

  • Fix incorrect year for datetime(date, 'week') when the week started the previous year. For example, 2021-01-01 is a Friday and its week belongs to 2020 (as per spec). In that case, the output was 2021-W53 instead of 2020-W53.

Improved

  • Improve type definitions where ? and undefined are redundant by removing undefined:
    • for some signatures of optional parameters from datetime(date?: Date | undefined to datetime(date?: Date
    • for some optional properties from { w?: number | undefined } to { w?: number }

Documentation

  • Use brotli compression instead of gzip one to express the module size.

Under the hood

  • Enforce type definitions for optional properties of the internal config functions setConfig and setTzConfig: it was possible to omit their separator property, it’s not anymore.
  • Upgrade ESLint from 8 to 9 and lint tests using eslint-plugin-vitest.
  • Split test file and move tests closer to the code.

1.3.3

23 Feb 21:45
Compare
Choose a tag to compare

Fixed

  • Fix .js file extension missing in an import statement when trying to import { datetime }, which worked in some bundlers but could fail in others or when not using any bundler. This issue was introduced in version 1.3.0.

Documentation

  • Fix typos.

Under the hood

  • The NPM command to test types has been changed from test-types to test:types.
  • Update tooling for Node 20.
  • Configure the dependencies update automation to group them by categories.
  • Monitor package size on pull request.

1.3.2

05 Aug 21:57
507a08b
Compare
Choose a tag to compare

Improved

  • Shorten daysBetween() and DateTime footprint by a couple of bytes.

Warning

If not transpiled, DateTime now requires support for class fields (Safari 14.0).

Under the hood

  • Replace NPM by pnpm.

1.3.2.-0

05 Aug 21:21
6d0c1b6
Compare
Choose a tag to compare
1.3.2.-0 Pre-release
Pre-release

Pre-release. Same content as in 1.3.2.

1.3.1

10 Feb 10:26
Compare
Choose a tag to compare

Fixed

  • Typo (grammar) in types documentation.

Under the hood

  • Add code of conduct, issue template, contributing guidelines, code analysis, dependabot, CodeQL.
  • Replace Jest by Vitest.

1.3.0

10 Oct 00:24
50c24c3
Compare
Choose a tag to compare

New

  • Support years with more then 4 digits (12345-01-01).
  • Support years prior to year 1 (-0051-01-01).
  • Add setTimeSeparator() to customize the separator between date and time.

Fixed

  • Missing zero-padding in front of years with less then 4 digits (0537-01-01).

Documentation

  • Update links to bundles sizes.

Under the hood

  • Update development dependencies.
  • Update package.json description and keywords fields.
  • Update GitHub actions.

1.2.0

09 Mar 23:04
Compare
Choose a tag to compare

New

  • Add setTzSeparator() to customize the hours-minutes separator of timezone offsets.
  • Add a Precision type for the precision parameter of datetime, datetimeTz and DateTime.to, and a subset of this new type for utc. It autocompletes the parameter (in modern code editors) with the available keywords.

Under the hood

  • Improve types generation.

1.1.0

01 Nov 10:59
Compare
Choose a tag to compare

New

  • Add a DateTime() class extending the native Date object. Available methods: getWeek(), setWeek() and to().

Fixed

  • Allow datetimeTz() without parameters. Before, the date was mandatory.
  • Improve types declaration.

Under the hood

  • Add a NPM script to generate types.
  • Update ESLint rules.