Skip to content

Commit

Permalink
chore: added initial ground work for jsr
Browse files Browse the repository at this point in the history
  • Loading branch information
khawarizmus committed Apr 9, 2024
1 parent f777350 commit b9f45be
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md"],
"assets": ["package.json", "jsr.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
Expand Down
5 changes: 5 additions & 0 deletions jsr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "@zaman/week-dates",
"version": "1.0.3",
"exports": "./src/index.ts"
}
2 changes: 1 addition & 1 deletion src/common/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function instantToOtherTemporal<T>(instant: Temporal.Instant, target: T):
* @return {number} a % b where the result is between 0 and b (either 0 <= x < b
* or b < x <= 0, depending on the sign of b).
*/
export const pymod = function (a: number, b: number) {
export const pymod = function (a: number, b: number): number {
const r = a % b
// If r and b differ in sign, add b to wrap the result to the correct sign.
return r * b < 0 ? r + b : r
Expand Down
4 changes: 2 additions & 2 deletions src/plainWeekDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class PlainWeekDate {

// TODO: document that the calendar part will always display the super id not the actual calendar id
// string format: "yyyy-Www-d"
toString(options?: ToStringOptions) {
toString(options?: ToStringOptions): string {
const optionsToUse = options ? Object.assign({}, this.options, options) : this.options
const showWeekDay = optionsToUse.weekStartDay === 'always' || (optionsToUse.weekStartDay === 'auto' && this.weekStartDay !== 1)
const showCalendar = optionsToUse.calendarName === 'always' || (optionsToUse.calendarName === 'auto' && this.calendarId !== 'iso8601')
Expand All @@ -125,7 +125,7 @@ export class PlainWeekDate {
}

// string format: "yyyyWwwd"
toStringCompact(options?: ToStringOptions) {
toStringCompact(options?: ToStringOptions): string {
const optionsToUse = options ? Object.assign({}, this.options, options) : this.options
const showWeekDay = optionsToUse.weekStartDay === 'always' || (optionsToUse.weekStartDay === 'auto' && this.weekStartDay !== 1)
const showCalendar = optionsToUse.calendarName === 'always' || (optionsToUse.calendarName === 'auto' && this.calendarId !== 'iso8601')
Expand Down

0 comments on commit b9f45be

Please sign in to comment.