Skip to content

Commit

Permalink
Merge branch 'release/v0.25.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
holtwick committed Oct 31, 2024
2 parents 5087975 + 6741e33 commit f4e1d47
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zeed",
"type": "module",
"version": "0.25.6",
"version": "0.25.7",
"description": "🌱 Simple foundation library",
"author": {
"name": "Dirk Holtwick",
Expand Down
6 changes: 4 additions & 2 deletions src/common/data/day.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export function dayToDate(day: DayValue, utc = false): Date {
? new Date(`${dayToString(day)}T00:00:00.000Z`)
: new Date(
day / 10000, // year
((day / 100) % 100) - 1, // month
day % 100, // day
Math.max(0, ((day / 100) % 100) - 1), // month
Math.max(1, day % 100), // day
)
}

Expand Down Expand Up @@ -109,6 +109,7 @@ export function dayToString(day: DayValue, sep = '-') {
)
}

/// Day value from parts, returns undefined if invalid
export function dayFromParts(
year: number,
month = 1,
Expand All @@ -119,6 +120,7 @@ export function dayFromParts(
return year * 10000 + month * 100 + day
}

/// Day value from string, returns undefined if invalid
export function dayFromString(value: string): DayValue | undefined {
const string = String(value)
.replace(/\D/g, '')
Expand Down

0 comments on commit f4e1d47

Please sign in to comment.