aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.31k stars 243 forks source link

datastore adds UTC mark to AWSTime values even when they don't have it on android - next #2214

Open ragingsquirrel3 opened 1 year ago

ragingsquirrel3 commented 1 year ago

Description

In the next branch on Android, if I have a model with type of AWSTime and I save a time that does not include timezone (which is optional), the version of the model that I query from the datastore will always include "Z" to indicate UTC.

Expected: AWSTime values respect inclusion/omitting timezone as saved

This is on next branch (built with aft). I suspect the issue is with amplify-android but will raise issue over there after collecting a little more data.

Categories

Steps to Reproduce

      final now = TemporalTime.now();
      print(now.toString()); // => "21:37:56.955359000"
      final model =
          ModelWithAppsyncScalarTypes(awsTimeValue: TemporalTime.now());
      await Amplify.DataStore.save(model);

      var queriedModels = await Amplify.DataStore.query(
          ModelWithAppsyncScalarTypes.classType,
          where: ModelWithAppsyncScalarTypes.ID.eq(model.id));
      print(queriedModels.first.awsTimeValue); // => "21:37:56.957149000Z"

Screenshots

No response

Platforms

Android Device/Emulator API Level

No response

Environment

n/a

Dependencies

n/a

Device

android emulator

OS

n/a

Deployment Method

Amplify CLI

CLI Version

No response

Additional Context

No response

Amplify Config

graphql config

HuiSF commented 1 year ago

Is this happening only in Android? If I remembered correctly, amplify-ios datastore enforces this iso8601 string format too before store data, time strings into local DB.

ragingsquirrel3 commented 1 year ago

Only happening in Android on next.