or run

npx @tessl/cli init
Log in

Version

Files

tile.json

task.mdevals/scenario-4/

Configuration File Timestamp Converter

Build a utility that converts JavaScript Date objects within configuration data into Apple plist XML format with properly formatted ISO 8601 timestamps.

Requirements

Your utility should accept JavaScript objects that may contain Date objects and convert them to plist XML format. The Date objects must be serialized using ISO 8601 format as required by Apple's plist specification.

The converter should:

  • Accept any JavaScript object that may contain Date objects
  • Convert the entire object to plist XML format
  • Ensure Date values are properly formatted in ISO 8601 format with UTC timezone
  • Return the complete plist XML as a string

Implementation

@generates

API

/**
 * Converts a JavaScript object containing Date values to plist XML format.
 *
 * @param {Object} config - Configuration object that may contain Date values
 * @returns {string} The plist XML representation with ISO 8601 formatted dates
 */
function convertConfigToPlist(config) {
  // IMPLEMENTATION HERE
}

module.exports = { convertConfigToPlist };

Test Cases

Basic date conversion

  • Given an object { createdAt: new Date('2023-06-15T10:30:45.000Z') }, the output XML should contain a <date> element with the value 2023-06-15T10:30:45Z @test

Multiple dates

  • Given an object { start: new Date('2023-01-01T00:00:00.000Z'), end: new Date('2023-12-31T23:59:59.000Z') }, the output XML should contain two <date> elements with values 2023-01-01T00:00:00Z and 2023-12-31T23:59:59Z respectively @test

Mixed data types

  • Given an object { name: 'App Config', version: 1, enabled: true, lastModified: new Date('2024-03-20T14:22:33.000Z') }, the output should be valid plist XML containing all values in their appropriate format @test

Nested dates

  • Given an object { metadata: { created: new Date('2022-05-10T08:15:00.000Z'), tags: ['config', 'production'] } }, the nested date should be properly formatted in the resulting plist XML @test

Dependencies { .dependencies }

plist { .dependency }

Provides plist XML generation with ISO 8601 date serialization support.

@satisfied-by