docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Build a utility that converts JavaScript Date objects within configuration data into Apple plist XML format with properly formatted ISO 8601 timestamps.
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:
/**
* 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 };{ 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{ 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{ 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{ 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 @testProvides plist XML generation with ISO 8601 date serialization support.