You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

lu-utils-dataaccess.js 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * Created by robin on 12/11/16.
  3. */
  4. (function () {
  5. 'use strict';
  6. angular.module('luticate2Utils')
  7. .factory('luUtilsDataAccess', [function () {
  8. var luUtilsDataAccess = {};
  9. luUtilsDataAccess.momentDateTimeToString = function(date)
  10. {
  11. if (date == null) {
  12. return null;
  13. }
  14. return date.toISOString();
  15. };
  16. luUtilsDataAccess.stringToMomentDateTime = function(str)
  17. {
  18. if (str == null) {
  19. return null;
  20. }
  21. return new Date(str);
  22. };
  23. luUtilsDataAccess.dateTimeToString = function(date)
  24. {
  25. if (date == null) {
  26. return null;
  27. }
  28. var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds())).toISOString();
  29. return d;
  30. };
  31. luUtilsDataAccess.stringToDateTime = function(str)
  32. {
  33. if (str == null) {
  34. return null;
  35. }
  36. var date = new Date(str);
  37. var d = new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());
  38. return d;
  39. };
  40. return luUtilsDataAccess;
  41. }]);
  42. })();