Skip to content

Commit

Permalink
date value not serialized to local and date only value in toml fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maliknajjar committed Sep 27, 2024
1 parent f024a81 commit c1d714f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "guifier",
"version": "1.0.31",
"version": "1.0.32",
"type": "module",
"license": "MIT",
"description": "An interactive front-end toolkit simplifying JSON, YAML, TOML, and XML data. Visualize, edit, convert formats, and perform real-time data manipulations. Empower your data-driven apps with user-friendly data processing and interactive visualization.",
Expand Down
10 changes: 8 additions & 2 deletions src/guifier/classes/Data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import clone from 'clone'
import type { Property, Parameters } from '../types'

import { XMLParser, XMLBuilder } from 'fast-xml-parser'
import { parse as tomlParse, stringify as tomlStringify } from 'smol-toml'
import { TomlDate, parse as tomlParse, stringify as tomlStringify } from 'smol-toml'
import { defaultProperty } from '../types'
import { DataType, PrimitiveTypes } from '../enums'
import { getFieldTypeByValuetype, getType, mergeObjectsOnlyNewProperties } from '../utils'
Expand Down Expand Up @@ -133,7 +133,13 @@ export class Data {
}
case DataType.Toml:
try {
return tomlStringify(data)
const processedData = lodash.cloneDeepWith(data, (value: any, key: any) => {

Check failure on line 136 in src/guifier/classes/Data.ts

View workflow job for this annotation

GitHub Actions / publish

'key' is declared but its value is never read.
if (value instanceof Date) {
value = new TomlDate(value.toISOString().split('T')[0])
return value
}
})
return tomlStringify(processedData)
} catch (error: any) {
throw new Error(error)
}
Expand Down

0 comments on commit c1d714f

Please sign in to comment.